Add to ThisWorkbook->Workbook code.
Private Sub Workbook_Open()
Dim oSht As Worksheet
Dim xlCalc As XlCalculation
On Error GoTo ErrorHandler
'remember the user's calculation setting before setting it to manual
xlCalc = Application.Calculation
Application.Calculation = xlCalculationManual
For Each oSht In Worksheets
oSht.EnableCalculation = False
oSht.EnableCalculation = True
Next oSht
Application.Calculate
ErrorExit:
On Error Resume Next
'restore the user's calculation setting
Application.Calculation = xlCalc
'the ErrorHandler code should only be executed if there is an error
Exit Sub
ErrorHandler:
Debug.Print Err.Number & vbLf & Err.Description
Resume ErrorExit
End Sub
Post a Comment