turn off/on automatic calc upon open/close workbook?

W

wdeleo

I am giving up on my code ... it runs so damned slow with auto calc on and I
just don't know why. With calc set to manual and calc calls within the code,
all runs well. So ...

Could someone please tell me how I can turn calc to manual upon opening my
workbook and then turn it back to auto upon closing? I need the user to find
it seemless and not a hassle.

TIA
WD
 
D

Die_Another_Day

Application.Calculation = xlCalculationManual
Application.Calculation = xlCalculationAutomatic
Die_Another_Day
 
W

wdeleo

Great, but how do I go about running that line of script upon opening the
workbook? How do I tell Excel to use manual calc for ONLY this workbook?
What if the user has another workbook open at the same time?

Thanks
 
N

NickHK

Application.Calculation, by definition, is an application-wide setting, so
will affect all open workbooks. If that is a problem, just switch to manual
whilst your code is running:
With Application
.Calculation = xlCalculationManual
'Your Code
.Calculation = xlCalculationAutomatic
End With

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top