VBA looping - creating multiple excels

ericlch16

Active Member
Joined
Nov 2, 2007
Messages
292
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hi

i have built a macro to
  1. Open an external excel (50,000 rows)
  2. Filter the external excel data based on a filter criteria (10,000 rows left after filter)
  3. Loop 10000 time through the filter data in external excel (using xlvisiblecells only)
  4. create an individual excel for each of the row from the loop. Each excel has multiple sheets.
  5. populate individual excel based on that filter data columns ( i don't copy and paste. I use range transfer for speed )
  6. save individual excel
This is working well. But I am wondering if I can improve the speed. it take 25 mins to do and i want to reduce the time. I have 10,000 rows and hence 10,000 workbooks to create and a lot of workbooks window to switch from. Will these improve speed?

  • A. Should i copy the filtered data to Thisworkbook and then loop from Thisworkbook instead?
  • B. Should I copy the filtered data to Thisworkbook and then copy to an array and then loop from the array ?
  • C. Copy filtered data from external excel to an array and then loop from array? (i could not do this because cells are not contiguous )
Which this save time considerably if A and B is done?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

ericlch16

Active Member
Joined
Nov 2, 2007
Messages
292
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
FYI. I did option B. I saved 10 mins. array is much faster than switching between workbooks window. looping in array is faster than workbook.
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,129,867
Messages
5,638,757
Members
417,051
Latest member
arthur_w

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top