+ Reply to Thread
Results 1 to 8 of 8

Quicker way to loop through WorksheetFunction?

  1. #1
    Forum Contributor
    Join Date
    07-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    211

    Quicker way to loop through WorksheetFunction?

    Hi

    I have the following code that loops through data to check what mileage each vehicle has done between "Current Month" and "Last Month".

    The code uses WorksheetFunction.Vlookup to compare vehicle registrations for current & last months and their corresponding mileage readings.

    Finally, the mileage readings difference between current month and last month is placed in column 12 of current month to give the mileage done in current month.

    The code works fine but takes about 7 seconds to complete its trawl through about 300 rows of data.

    As the list is likely to increase in future, I was wondering if there is a quicker way to loop?

    Any advice would be greatly appreciated.

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Quicker way to loop through WorksheetFunction?

    Any chance of posting a copy of your workbook?
    If you like my contribution click the star icon!

  3. #3
    Forum Contributor
    Join Date
    07-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    211

    Re: Quicker way to loop through WorksheetFunction?

    Sorry about the delay. A sample is attached
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    211

    Re: Quicker way to loop through WorksheetFunction?

    Any thoughts?


  5. #5
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Quicker way to loop through WorksheetFunction?

    I was in a meeting at work. Will have a look

  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Quicker way to loop through WorksheetFunction?

    Please try

    Please Login or Register  to view this content.

  7. #7
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Quicker way to loop through WorksheetFunction?

    or, using a different approach

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    211

    Re: Quicker way to loop through WorksheetFunction?

    Wow! A completely new approach, OllieB

    I will try this out and let you know how I get on.

    Many thanks for taking the time to help

+ 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. more efficient way to do for-loop using application.worksheetfunction.countifs
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 09-08-2013, 10:36 PM
  2. worksheetfunction.countifs with loop from multiple worksheets
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2012, 04:55 PM
  3. worksheetfunction.countifs with loop
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2012, 01:26 PM
  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

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