Tim Hanson
Member
I wrote a goFast macro and need some input on it from those who know more then I do
I use like this:
Sub myMacro()
goFast False
Code
goFast True
End Sub
Do I have redundant elements in it e.g is
Case False
.Calculation = xlCalculationManual
Case True
.Calculation = xlCalculationAutomatic
The same as
Case False
.EnableCalculation = False
Case True
.EnableCalculation = True
Are there elements that would be good to have but I am missing or are there elements that I should remove?
Thanks for any input
I use like this:
Sub myMacro()
goFast False
Code
goFast True
End Sub
Do I have redundant elements in it e.g is
Case False
.Calculation = xlCalculationManual
Case True
.Calculation = xlCalculationAutomatic
The same as
Case False
.EnableCalculation = False
Case True
.EnableCalculation = True
Are there elements that would be good to have but I am missing or are there elements that I should remove?
Thanks for any input
Code:
Sub goFast(Optional iReset As Boolean = False, Optional EnableEvents As Boolean = True)
' Set various application properties.
ThisWorkbook.Application.EnableEvents = True
Select Case iReset
Case False
With ThisWorkbook.Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
.DisplayAlerts = False
.CutCopyMode = False
With ThisWorkbook.ActiveSheet
.EnableCalculation = False
End With
End With
Case True
With ThisWorkbook.Application
.Calculation = xlCalculationAutomatic
.ActiveSheet.UsedRange
.ScreenUpdating = True
.DisplayAlerts = True
.EnableEvents = True
.CutCopyMode = True
With ThisWorkbook.ActiveSheet
.EnableCalculation = True
End With
End With
End Select
End Sub