Turning Of Calculation

J

Joe Gieder

I use the following to turn off the calculation and then
back on when exiting my workbook.

Private Sub Workbook_Activate()
Application.Calculation = xlManual
Application.CalculateBeforeSave = False
End Sub

Private Sub Workbook_Deactivate()
Application.Calculation = xlAutomatic
Application.CalculateBeforeSave = True
End Sub

When I open only one workbook at a time it works fine but
when I open a second workbook with the same code it
starts to calculate also everytime I close my workbook it
asks if I want to save the changes. Is there a way to not
calculate when a second workbook is opened with the same
code and to not ask if I want to save changes unless I
have made changes?

TIA
Joe
 
T

Tom Ogilvy

When you go from one workbook to the other, it turns calculation back on I
believe. The activate event fires before the deactivate event I believe,
but it would be easy to test.

I guess you would have to figure out how to maintain your setting within the
way you intend to use your workbooks.
 

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