Speed Up Macro Advice

dgr

Board Regular
Joined
Apr 24, 2005
Messages
176
Hi,
I'm using Excel 2013. I would like to use some of the following code to speed up my processing.
Code:
Sub test()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.CutCopyMode = False
Application.DisplayStatusBar = False

'run any code

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
End Sub
My question if I have 10 macros running sequentially one after the other must I put the above mentioned code in every single macro? Can I put the 1st 4 lines of the above mentioned code in the 1st macro & the last 3 lines in the 10th macro?

Explained slightly differently can I do this to save my coding time?
Code:
Sub macro1()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.CutCopyMode = False
Application.DisplayStatusBar = False

'run any code

End Sub

Code:
Sub macro10()

'run any code

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
End Sub

Thanks for your advice.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I'm guessing you would have one central macro like this:

Code:
Sub CentralMacro()

    Application.Calculation = xlCalculationManual
    Application.ScreenUpdating = False
    Application.CutCopyMode = False
    Application.DisplayStatusBar = False

    Call macro1
    Call macro10

    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
    Application.DisplayStatusBar = True

End Sub
Hope this helps,

Chris.
 
Upvote 0
That should work for what you want, unless the macros in between turn those settings back on
 
Upvote 0
That's a good idea Chris. Thanks.
Thanks for the caution, Special-K99.
I'll do some experiments. Have a good day to the both of you.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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