Prevent automatic calculation for workbook being opened
Dear Colleagues,
Please advise with the subject, details are below.
I am getting exported data to excel and this data is in text format
which I am processing to get the values. The macro to process it is
located inside of add-in and it intercepts Application.WorkBookOpen
Event. The point is that excel is calculating twice, before my macro
runs and after. How I can prevent excel from double work? I have
workbooks with a lot of heavy formulas and to calculate all of them
take a time.
Below is my code:
Private Sub App_WorkbookOpen(ByVal wb As Workbook)
'Speed up the process
Application.Interactive = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
'Exit from Sub when no workbooks opened
If Application.Workbooks.Count < 1 Then
Exit Sub
End If
'Perform report manipulations here
Call ctApplyFormatting()
Call ctConvertToValues()
'Restoring Application default behaviour
Application.Interactive = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Thank you in advance.
BR,
Sergiy
|