I found the following code for using in projects to increase VBA performance.
What do you use for your projects?
Code:
[FONT=Courier]Option Explicit
Option Private Module
Private mlCalcStatus As Long
Private mbInSpeed As Boolean
Public Sub speed()
On Error Resume Next
If Not mbInSpeed Then
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
mlCalcStatus = Application.Calculation
Application.Calculation = xlCalculationManual
mbInSpeed = True
Else
'we are already in speed - don't do the settings again
End If
End Sub
Public Sub unspeed()
On Error Resume Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
If mbInSpeed Then
Application.Calculation = mlCalcStatus
Else
'this shouldn't be happening - put calc to auto - safest mode
Application.Calculation = xlCalculationAutomatic
End If
mbInSpeed = False
End Sub[/FONT]
What do you use for your projects?