a trick to speed things up

mhume

New Member
Joined
May 30, 2008
Messages
4
Not sure if this is common sense or not, but considering my excel macro's have gotten rather monstrous lately I started using a trick to speed things up.

' put this at the top of your code
Application.Calculation = xlManual

' put this at the end of your code
Application.Calculation = xlAutomatic
Calculate

For all my routines that manipulate formulas in my worksheets, I have seen HUGE reductions in load time from doing this. In some cases, from a couple minutes down to a few seconds. I think this trick is pretty much mandatory for any complex spreadsheet manipulations.

Just thought I'd share.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
This method is common practice along with others.

Another one is to turn off screen updating.
Code:
Application.ScreenUpdating = False
   ' rest of code
Application.ScreenUpdating = True
If your code has become 'monstrous' then it might be time to take a good look at it and see if it can be optimized/cleaned up.

How exactly that would be done is hard to tell without seeing the code or a sample of it.

And an explanation of the code's purpose wouldn't go amiss either.:)
 
Upvote 0

Forum statistics

Threads
1,216,733
Messages
6,132,410
Members
449,727
Latest member
Aby2024

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