Screen Updating using VBA in Excel



When you don't want to see your screen follow the actions of your VBA code (macro), you can use ScreenUpdating property:

Application.ScreenUpdating

Use ScreenUpdating property to turn screen updating off to speed up your macro code:

Application.ScreenUpdating = False

You won't be able to see what the macro is doing, but it will run faster. When your macro ends don't forget to set the ScreenUpdating property back to True.

Application.ScreenUpdating = True

Example:

'  Add New Worksheet
Private Sub GenerateNewWorksheet()
    Dim ActSheet As Worksheet
    Dim NewSheet As Worksheet
 
    ' Prevents screen refreshing.
    Application.ScreenUpdating = False

    Set ActSheet = ActiveSheet
    Set NewSheet = ThisWorkbook.Sheets().Add()
 
    NewSheet.Move After:=Sheets(ThisWorkbook.Sheets().Count)
 
    ActSheet.Select

     ' Enables screen refreshing.
    Application.ScreenUpdating = True
End Sub