ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to determine calculation setting? (https://www.excelbanter.com/excel-discussion-misc-queries/107172-how-determine-calculation-setting.html)

GoBobbyGo

how to determine calculation setting?
 
Is there a way to determine the calculation setting of Excel from within a
macro?

I write a lot of macros that turn off calculation so they'll run faster,
then turn it back on at the end.

Now I'm dealing with workbooks where automatic calculation is already turned
off, and for those I don't WANT it turned on at the end.

Is there a way to tell what the setting is so that I can set it back the way
it was when the macro's done?

JMB

how to determine calculation setting?
 
save the calculation setting before changing it to manual, then set it back
to the original setting at the end.

Sub test()
Dim lngCalc As Long

lngCalc = Application.Calculation
Application.Calculation = xlCalculationManual

'your code here

Application.Calculation = lngCalc
End Sub


"GoBobbyGo" wrote:

Is there a way to determine the calculation setting of Excel from within a
macro?

I write a lot of macros that turn off calculation so they'll run faster,
then turn it back on at the end.

Now I'm dealing with workbooks where automatic calculation is already turned
off, and for those I don't WANT it turned on at the end.

Is there a way to tell what the setting is so that I can set it back the way
it was when the macro's done?



All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com