+ Reply to Thread
Results 1 to 7 of 7

A quicker way to use a loop

  1. #1
    Registered User
    Join Date
    01-02-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    48

    A quicker way to use a loop

    Hi

    Hope you can help.

    I am wondering is there a quicker way to use a For loop as below, maybe a For Each? I am not that good with looping and your advice would be greatly appreciated.
    I use a for loop as each row in the sheet is assessed with a condition but this is a double check that not every row would contain a NOT AVAILABLE.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: A quicker way to use a loop

    No need to select...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-02-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    48

    Re: A quicker way to use a loop

    Thanks cytop. Good tip.

    This still loops row by row. What i was wondering is I have 30,000+ rows and maybe only 1,000 have NOT AVAILABLE. Is there a more efficient way to do so, maybe not?

  4. #4
    Forum Contributor gsnidow's Avatar
    Join Date
    07-22-2010
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2007
    Posts
    150

    Re: A quicker way to use a loop

    bkeat, you could try a For each loop on a range. I'm not going to say one way or the other if it is faster than what you have, but there are definitely situations where either one may come out the winner. If you really don't want to iterate through every row, you could do something like have your code filter for values, then update those cells, but, behind the scenes, the compiler is going to have to loop through each row anyway to apply a filter.
    Please Login or Register  to view this content.
    Greg

  5. #5
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: A quicker way to use a loop

    Hi, check out the three articles here

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: A quicker way to use a loop


    Hi,

    a quicker way is to use a filter to search the "Not Available" cells …

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: A quicker way to use a loop

    You can apply a filter to an entire data set in one go, no need to loop.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Quicker way to loop through WorksheetFunction?
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-07-2013, 05:11 AM
  2. Can the following Vba's be improved to run quicker.
    By Toonies in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-11-2012, 06:54 AM
  3. Is there a quicker way to do this
    By jonn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2008, 11:12 AM
  4. Quicker way?
    By Craiig in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-22-2008, 07:32 AM
  5. Quicker VBA
    By sparx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2007, 06:47 AM

Tags for this Thread

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