I got tired of writing all those
With Application
.blah blah
End With
So I use this instead
Private Function SpeedyCode(GoFast As Boolean)
'Usage:
'SpeedyCode True|False
Static Calc As Long
If Not CBool(Calc) then Calc = xlCalculationAutomatic
With Application
.ScreenUpdating = Not GoFast
.EnableEvents = Not GoFast
If GoFast Then
Calc = .Calculation
.Calculation = xlCalculationManual
Else
.Calculation = Calc
.Calculate
Calc = xlCalculationAutomatic
End If
End With
End Function
I also find this very handy
Private Sub ResetApplication
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End Sub