ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prevent automatic calculation for workbook being opened (https://www.excelbanter.com/excel-programming/371740-prevent-automatic-calculation-workbook-being-opened.html)

Sergiy

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


Sergiy

Prevent automatic calculation for workbook being opened
 
Is here any suggestions?

BR,
Sergiy



All times are GMT +1. The time now is 02:10 AM.

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