logo
search
VBA & Macro Problems

How to Fix Excel VBA Macro Screen Flickering at the End

Tauseeq MagsiTauseeq Magsi Oct 19, 2026 868 views

Question details

The user needs to eliminate screen flickering that occurs during the final moments of executing a VBA macro.

How to Stop Screen Flickering at the End of an Excel 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.
Before you start

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.

Solution 1Recommended

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.

1
Set up Application Variables

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.

2
Disable Settings During Execution

Use a 'With Application' block to set ScreenUpdating, EnableEvents, and DisplayAlerts to False, and set Calculation to xlCalculationManual before your main code runs.

3
Add Error Handling

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.

4
Create a CleanUp Label

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.

Implement a VBA Cleanup Structure to Manage Application Settings
Free Microsoft Office alternative

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. 1. Download and Install: Visit the official WPS website to download the free version of WPS Office and follow the installation wizard.
  2. 2. Open Your Macro Workbook: Launch WPS Spreadsheets and open your existing .xlsm files directly. Your VBA macros will remain intact.
  3. 3. Run Macros Smoothly: Execute your macros from the Developer tab and experience stable, fast performance during calculations.
Free, lightweight, and fast-loading office suiteExcellent compatibility with Microsoft Excel formats (.xlsx, .xlsm)Supports complex VBA macros and advanced spreadsheet automationFamiliar user interface for seamless migration without a learning curve
microsoft office alternative - wps office

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'.