Two Workbooks, Same VBA Code, One fast, One SLOW

SusaninHouston

Active Member
Joined
Jan 13, 2005
Messages
295
That's it in a nutshell -- I have two nearly identical worksheets, both approximately 6 MB in size. The two worksheets are nearly identical and are both running the same VBA code which works very quickly in one workbook and VERY SLOWLY in the other. Processing Speed is about 1 seconds in the fast model vrs 3 minutes in the slow.

What I've already checked:

Worksheet size - The slow model ends at about cell AB1500; the fast model ends at AB2500
No links in either
Moderate graphics - pretty similar in the two files
I never format beyond the active range
Similar number of range names
Same math in each sheet, though the slower one does have some VLookups. (I erased them, but no appreciable change in speed)
VBA turns off autocalc and screenupdating when running

I ran Task Manager when running both macros, and the smaller model showed 171 MB of memory in use; the larger model showed only 140 MB.

I ran the VBA code from the fast model on the slow model and it was still slow -- so truly, it's not the VBA

Any ideas for what it could be?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi SusaninHouston - Have you tried copying the entire worksheet from each into a new workbook? I have had situations that cleared themselves up when I just copied the data into a new workbook using Ctrl-A, then Ctrl-C and then paste into new workbook. The other thing I have tried on "slow" workbooks is to just take some of the data and put it into a new workbook. Sometimes it is a data issue and you can determine which data is slowing down the macros. Hope this helps get things started. Good luck!
 
Upvote 0
I never format beyond the active range

Sometimes a loop will cause Conditional Formatting to recalculate on every iteration, thus eating up memory and slowing progressively further into the loop.

Cheers,

tonyyy
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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
Back
Top