+ Reply to Thread
Results 1 to 3 of 3

Run code on 1000 files at a time

  1. #1
    Forum Contributor
    Join Date
    11-04-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    334

    Run code on 1000 files at a time

    I have a list of files in column A of a worksheet.
    There are 10,000 + files in the list.
    I would like to run the same macro on all the files in the list, BUT, processing only 1000 at a time because a worksheet is created for each file and having 10000+ worksheets doesn't work!

    I need to test what the last row will be, then set the loop to run to the last row in batches of 1000.
    if y = number of batches of 1000
    z = number of files
    Please Login or Register  to view this content.
    Any assistance in shortening this code to avoid loop after loop would be appreciated.

    Thanks

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Run code on 1000 files at a time

    Is z really number of files or last non-empty row in column A?

    Anyway look for such universal scheme (no need to calculate y at all):
    Please Login or Register  to view this content.
    so it is a "loop inside a loop" not "loop after a loop after a loop after a loop ..." approach
    Last edited by Kaper; 03-05-2016 at 04:33 AM.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    11-04-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    334

    Re: Run code on 1000 files at a time

    Thanks for the assistance Kaper,

    z is the last empty row
    Number of files is actually z -1 because row 1 is a header row!

    I will give your suggestion a trial.

+ 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. [SOLVED] Changing Pivot Table Source- Code Created Files Require Manual Refresh Each Time Opened
    By Aquamore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2015, 05:53 PM
  2. Help in macro code to stop code running for certain time
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-05-2015, 02:35 AM
  3. Vba code to convert xlsx files in xls files 2003 format
    By clixo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2014, 01:50 PM
  4. vba code throws an error first time but runs perfectly the second time. HELP!!
    By mvneema in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2014, 12:42 PM
  5. [SOLVED] VBA Code open files in folder, copy text to workbook-Next time folder opened copy only new
    By Bikeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-02-2013, 07:59 PM
  6. Formula for obtaining the total running time from the time code
    By hbsunshine in forum Excel - New Users/Basics
    Replies: 11
    Last Post: 03-06-2011, 05:26 AM
  7. vb code to return files giving too many files error message
    By camcrazy08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2007, 04:53 PM

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