How to Fix Excel VBA Macro Screen Flickering at the End
Question details
The user needs to eliminate screen flickering that occurs during the final moments of executing a VBA macro.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Running a custom VBA macro to automate worksheet tasks.
- Observed behavior
- The screen flickers near the end of the macro execution, typically when screen updating is restored while the code is still selecting cells, activating worksheets, or triggering background events.
Save a backup of your Excel workbook before modifying the VBA code, as changes made by running a macro cannot be reversed using the standard Undo feature.
Implement a VBA Cleanup Structure to Manage Application Settings
Safely disable screen updating and application events at the start of your macro, and restore them at the very end using an error-handling block.
By managing Application settings such as ScreenUpdating, EnableEvents, and Calculation throughout your procedure, you prevent Excel from redrawing the screen or calculating formulas until the macro has completely finished execution.
Open the VBA editor and declare boolean variables at the beginning of your Sub to store the current states of ScreenUpdating, EnableEvents, DisplayAlerts, and Calculation.
Use a 'With Application' block to set ScreenUpdating, EnableEvents, and DisplayAlerts to False, and set Calculation to xlCalculationManual before your main code runs.
Place 'On Error GoTo CleanUp' at the top of your macro. This ensures that if an error occurs, the macro jumps directly to the cleanup section and properly restores screen updating.
Add a 'CleanUp:' label at the very end of your code block. Use another 'With Application' block here to reapply the original application settings stored in your variables before the 'End Sub' statement.

Eliminate Select and Activate Methods from the Code
Modify your macro to manipulate objects directly rather than selecting or activating worksheets and ranges.
Experience Smooth Data Processing with WPS Office
If you frequently encounter performance issues, screen flickering, or application lags while running complex VBA macros in Microsoft Excel, consider trying WPS Office. It provides a lightweight, highly compatible alternative for managing your spreadsheets and automating tasks.
- 1. Download and Install: Visit the official WPS website to download the free version of WPS Office and follow the installation wizard.
- 2. Open Your Macro Workbook: Launch WPS Spreadsheets and open your existing .xlsm files directly. Your VBA macros will remain intact.
- 3. Run Macros Smoothly: Execute your macros from the Developer tab and experience stable, fast performance during calculations.

Frequently Asked Questions
Why does Application.ScreenRefresh result in an error?
Microsoft Excel VBA does not have an 'Application.ScreenRefresh' method built into its object model. Attempting to call it will trigger an error. You must manage screen redrawing by toggling 'Application.ScreenUpdating' between False and True instead.
Can I use Application.Wait to stop the flickering at the end of my macro?
Adding 'Application.Wait' or manual delays at the end of a macro is not recommended unless your code has a highly specific timing requirement. It only temporarily masks the flickering issue and unnecessarily slows down your macro's execution time.
Why does my macro only flicker during the very last microsecond of execution?
This usually happens because 'Application.ScreenUpdating' is restored to True while the final lines of your code are still executing selections, activating different worksheets, or triggering secondary event macros like 'Worksheet_Change'.




