ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Turn AutoCalc before calc takes place (https://www.excelbanter.com/excel-programming/403716-turn-autocalc-before-calc-takes-place.html)

Mitch Powell

Turn AutoCalc before calc takes place
 
It is critical that a particular workbook NOT calculate upon opening, so I
used the following:

Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
End Sub

The problem is that if calculation is is already in auto mode when workbook
is opened, calculation takes place before this code can run and turn it off.
Any ideas?

GTVT06

Turn AutoCalc before calc takes place
 
On Jan 5, 12:19*pm, Mitch Powell
wrote:
It is critical that a particular workbook NOT calculate upon opening, so I
used the following:

Private Sub Workbook_Open()
* *Application.Calculation = xlCalculationManual
End Sub

The problem is that if calculation is is already in auto mode when workbook
is opened, calculation takes place before this code can run and turn it off. *
Any ideas?

What if you were to have the workbook set the calculation mode to
manual before closing the workbook so next time it's opened it's
already set to manual and wont auto calculate?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Calculation = xlCalculationManual
End Sub

Mitch Powell

Turn AutoCalc before calc takes place
 
Won't work since I can't control the mode that Excel is in when the workbook
is opened. Most users' machines are in autocalc mode as a matter of course.

"GTVT06" wrote:

On Jan 5, 12:19 pm, Mitch Powell
wrote:
It is critical that a particular workbook NOT calculate upon opening, so I
used the following:

Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
End Sub

The problem is that if calculation is is already in auto mode when workbook
is opened, calculation takes place before this code can run and turn it off.
Any ideas?

What if you were to have the workbook set the calculation mode to
manual before closing the workbook so next time it's opened it's
already set to manual and wont auto calculate?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Calculation = xlCalculationManual
End Sub


Gord Dibben

Turn AutoCalc before calc takes place
 
GTVT06

Note: if a workbook set to automatic calculation is opened prior to opening the
workbook with the BeforeClose code, calculation will revert to automatic because
the first workbook sets the mode for subsequent workbooks.


Gord Dibben MS Excel MVP


On Sat, 5 Jan 2008 10:28:00 -0800 (PST), GTVT06 wrote:

On Jan 5, 12:19*pm, Mitch Powell
wrote:
It is critical that a particular workbook NOT calculate upon opening, so I
used the following:

Private Sub Workbook_Open()
* *Application.Calculation = xlCalculationManual
End Sub

The problem is that if calculation is is already in auto mode when workbook
is opened, calculation takes place before this code can run and turn it off. *
Any ideas?

What if you were to have the workbook set the calculation mode to
manual before closing the workbook so next time it's opened it's
already set to manual and wont auto calculate?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Calculation = xlCalculationManual
End Sub



Dave Peterson

Turn AutoCalc before calc takes place
 
How about creating a 2nd workbook to open the real workbook.

It can change the calculation mode to manual, then open the real workbook, then
close itself.



Mitch Powell wrote:

It is critical that a particular workbook NOT calculate upon opening, so I
used the following:

Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
End Sub

The problem is that if calculation is is already in auto mode when workbook
is opened, calculation takes place before this code can run and turn it off.
Any ideas?


--

Dave Peterson

Mitch Powell

Turn AutoCalc before calc takes place
 
Thought of that would prefer not to if there is another solution (just
another step in the user experience). Looks like there isn't another
solution so this is probably the way to go. Thanks.

"Dave Peterson" wrote:

How about creating a 2nd workbook to open the real workbook.

It can change the calculation mode to manual, then open the real workbook, then
close itself.



Mitch Powell wrote:

It is critical that a particular workbook NOT calculate upon opening, so I
used the following:

Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
End Sub

The problem is that if calculation is is already in auto mode when workbook
is opened, calculation takes place before this code can run and turn it off.
Any ideas?


--

Dave Peterson



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

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