How to stop screen flickering while running macros in Excel?

In Excel VBA, the Application.ScreenUpdating property is used to control whether or not screen updating occurs during macro execution. By setting Application.ScreenUpdating to False, you can prevent the screen from flickering or updating as your code runs, which can help improve the performance and speed of your macro. Here’s how you can use it:

Disabling Screen Updating

To disable screen updating, use the following code

Application.ScreenUpdating = False

Place this line of code at the beginning of your macro or subroutine to disable screen updating. By turning off screen updating, any changes made to the Excel interface will not be displayed until the screen updating is enabled again.

Enabling Screen Updating

To enable screen updating, use the following code:

Application.ScreenUpdating = True

Place this line of code at the end of your macro or subroutine to re-enable screen updating.

Example

Here’s an example that demonstrates the usage of Application.ScreenUpdating

Sub MyMacro()
    'Disable Screen Updating
    Application.ScreenUpdating = False
    
    ' Your code here
    
    'Enable Screen Updating
    Application.ScreenUpdating = True
End Sub

By turning off screen updating, any changes made to the Excel interface will not be displayed until the screen updating is enabled again. This can help speed up the execution of your macro, especially if it involves modifying a large number of cells or performing complex calculations.

Switch the language

Spanish

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project