clsSpeedUp.cls
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "clsSpeedUp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Const sModule As String = "clsSpeedUp"
'==================================================================================================================================================
' MEMBER CONSTANTS
'==================================================================================================================================================
'==================================================================================================================================================
' MEMBER VARIABLES
'==================================================================================================================================================
Private CalculationState As XlCalculationState
'==================================================================================================================================================
' PROPERTIES
'==================================================================================================================================================
'==================================================================================================================================================
' CLASS EVENTS
'==================================================================================================================================================
Private Sub Class_Initialize()
SpeedUp
End Sub
Private Sub Class_Terminate()
RestoreSpeed
End Sub
'==================================================================================================================================================
' METHODS
'==================================================================================================================================================
Private Sub SpeedUp()
CalculationState = Application.Calculation
Application.ScreenUpdating = False
Application.Calculation = xlManual
Application.EnableEvents = False
End Sub
Private Sub RestoreSpeed()
On Error Resume Next
Application.ScreenUpdating = True
Application.Calculation = CalculationState
Application.EnableEvents = True
Application.DisplayAlerts = True
Application.DisplayStatusBar = True
Application.StatusBar = False
End Sub