EnableEvents
Hi Clara
EnableEvents = false and EnableEvents = true need to be paired ? Similiar
issue are ScreenUpdating,DisplayAlerts.
Normally, yes!
More generally, changes which are made to application
settings should normally be reversed by your code when
no longer required.
It is often therefore, advisable to restore application settings
to their previous state in an error handler; in this way any
error in the code will not prevent the desired restoration of
the previous settings. An example might be:
'================
Public Sub Tester()
Dim CalcMode As Long
On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
'Your code
XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'<<================
---
Regards,
Norman
|