+ Reply to Thread
Results 1 to 9 of 9

For each loop issue

  1. #1
    Registered User
    Join Date
    06-04-2007
    Posts
    61

    For each loop issue

    I am trying to say the following

    for each "value" in "this array"
    do this
    next for

    I am unsure how to select a single value out of an array using a for each loop.

    Note:
    the array holds a group of string values

    Sample data:
    href=, scr=,...

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    This what you mean?
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-04-2007
    Posts
    61
    Is it possible to use this type of loop for a multi-dim array?

    for each x in array(a:a, b:b, c:c...)
    do this
    next x

  4. #4
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    If you're using ranges:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-04-2007
    Posts
    61
    Thanks for the quick reply, but how do I pick apart the array?

    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    and if I declare the string in the code, what do I use as seperaters?

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 10-19-2007 at 06:31 PM.

  6. #6
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    What is your array exactly? An explanation of what it is you're trying to accomplish might also be helpful.

  7. #7
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  8. #8
    Registered User
    Join Date
    06-04-2007
    Posts
    61
    Here is the code I am currently using
    Please Login or Register  to view this content.
    My problem is with this section
    Please Login or Register  to view this content.
    I am looking to use the first value as the folder name from outlook and the second name in place of "Test" as the download location. I can do this with a for loop and copy of the values in a sheet, but I would like this all hidden in a macro that I can lock and prevent changes by those pesky people who want to get into everything, hense the desire for a for each loop with a multi-dim array.

    NOTE: The sample above only has one run worth of values within it.

  9. #9
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    Here are some ways to manipulate arrays. Obviously you can use something other than "Activecell.offset" to determine the value, I just used this example so as to, hopefully, be easier to understand what the macro is doing.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1