+ Reply to Thread
Results 1 to 4 of 4

Looping through an array

  1. #1
    Registered User
    Join Date
    03-05-2008
    Posts
    17

    Looping through an array

    Hi all,
    This is probably a very simple baby stuff, but I'm so new at VBA. Still trying to learn...

    I'm trying to establish a loop, but that loop will be a list, rather than constantly increasing numbers. In the example below (i = 1 to 100), I would like i to be something like {i = 1,3,8,11,12,20,22,...,100}. Actually I have a quite long list for i. So, how do I make sure that the loop goes through my pre-defined list?

    And secondly, my code activates each file twice during the loop, which makes it very slow. Is it possible to make it faster (i.e. without actually activating windows?).

    Many thanks..
    -levent



    Please Login or Register  to view this content.
    Last edited by levo_redkid; 02-02-2011 at 04:34 PM.

  2. #2
    Registered User
    Join Date
    01-10-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Looping through an array

    I've been waiting for someone to ask something I think I can actually answer! haha. As far as the looping array, I'm looking into that for a project I'm working on now as well so I can't help there but I think, if you put this code;

    Please Login or Register  to view this content.
    before you actually start anything else in the code, it stops the windows from updating, making the program a bit faster. If I'm wrong, one of the real guys will let you know, but I'm pretty sure I'm not on this one.
    I can't always post examples of what I might be asking about due to confidentiality issues, but I WILL try to explain my problems as thoroughly as I can.

  3. #3
    Registered User
    Join Date
    03-05-2008
    Posts
    17

    Re: Looping through an array

    Thanks for that. But I'm still waiting for the core answer.

    I found smth like below, maybe it might help you with your case:


    Please Login or Register  to view this content.

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Looping through an array

    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