Performance Implications of Screen Updating
Sub TimeScreenUpdating()
Dim dResult As Double
dResult = TestScreenUpdating(True)
MsgBox Format(dResult, "0.00") & " seconds.", vbOKOnly
dResult = TestScreenUpdating(False)
MsgBox Format(dResult, "0.00") & " seconds.", vbOKOnly
End Sub
Function TestScreenUpdating(bUpdatingOn As Boolean) As Double
Dim nRepetition As Integer
Dim ws As Worksheet
Dim dStart As Double
dStart = Timer
Application.ScreenUpdating = bUpdatingOn
For nRepetition = 1 To 250
For Each ws In ThisWorkbook.Worksheets
ws.Activate
Next
Next
Application.ScreenUpdating = True
TestScreenUpdating = Timer - dStart
Set ws = Nothing
End Function
Related examples in the same category