Building a “Reset” macro to fix Excel settings after a crash (Calculation, ScreenUpdating).

When an Excel macro crashes, stops midway, or is manually canceled with Ctrl + Break, it often leaves the application in an unusable state. Excel may stop updating the screen, formulas may refuse to calculate automatically, system alerts may fail to appear, and mouse pointers can stay stuck as an hourglass. This happens because performance optimization properties like ScreenUpdating and Calculation apply globally to the entire Excel application—and they do not reset automatically when code terminates unexpectedly.

Quick Answer

Store a standalone “Reset” macro in your Personal.xlsb workbook or an accessible utility module. This macro restores Application.ScreenUpdating = True, Application.Calculation = xlCalculationAutomatic, Application.EnableEvents = True, Application.DisplayAlerts = True, and resets the cursor and status bar back to their operational defaults.


The Cause: Unrestored Global Application Properties

To run quickly, production VBA scripts typically turn off several application-level features:

  • ScreenUpdating: Disables window repainting to speed up loop execution.
  • Calculation: Suspends formula evaluations to prevent delays during batch cell writes.
  • EnableEvents: Blocks triggers like Worksheet_Change to avoid event cascades.
  • DisplayAlerts: Suppresses confirmation prompts (such as sheet deletion warnings).
  • Cursor & StatusBar: Shows progress indicators and changes the mouse pointer.

Because these flags belong to the root Application object, they persist across every open workbook in your Excel session. If your macro encounters an unhandled runtime error before restoring these flags, Excel remains frozen in that restricted mode.

Normal State ────> Macro starts (Optimizations ON) ────> Crash / Break Mode
                                                              │
                                                              ▼
Excel remains stuck: Screen won't paint, calculation stays manual, events dead
                                                              │
                                                              ▼
               Run "Reset Macro" ────> Full UI & Engine Restored

The Universal Reset Macro

Save this subroutine in your Personal Macro Workbook (Personal.xlsb) so it is available in any Excel session regardless of which workbooks are open:

Public Sub ResetExcelEnvironment()
    On Error Resume Next ' Ensure every reset line executes regardless of errors

    With Application
        ' 1. Display and UI rendering
        .ScreenUpdating = True
        .DisplayStatusBar = True
        .StatusBar = False
        .Cursor = xlDefault

        ' 2. Calculation engine
        .Calculation = xlCalculationAutomatic
        .Calculate

        ' 3. System and event handling
        .EnableEvents = True
        .DisplayAlerts = True

        ' 4. Page layout and printer communication overhead
        .PrintCommunication = True
    End With

    ' Optional visual feedback confirmation
    MsgBox "Excel application settings have been restored to defaults.", _
           vbInformation, "System Reset Complete"
End Sub

Why On Error Resume Next is used here: In a dedicated reset utility, you do not want an error on one property (such as .PrintCommunication failing due to a missing default printer) to block the remaining properties from resetting. For guidance on when this pattern is appropriate versus when it introduces risks, see Using On Error Resume Next vs. On Error GoTo 0 (The right way).


Setting Up Fast Access to the Reset Macro

When Excel’s interface is frozen, you cannot click worksheet buttons. Configure one of these fast access routes instead:

Option 1: Assign a Keyboard Shortcut

  1. In Excel, press Alt + F8 to open the Macro dialog.
  2. Select Personal.xlsb!ResetExcelEnvironment.
  3. Click Options….
  4. Assign a memorable key combination, such as Ctrl + Shift + R.
  5. Click OK.

Whenever Excel stops repainting or formulas freeze, pressing Ctrl + Shift + R instantly restores the application.

Option 2: Add a Quick Access Toolbar (QAT) Button

  1. Click the small arrow on the Quick Access Toolbar (top left of the Excel title bar) and select More Commands….
  2. Under Choose commands from, select Macros.
  3. Select Personal.xlsb!ResetExcelEnvironment and click Add >>.
  4. Click Modify…, select an identifiable icon (such as a green checkmark or reset arrows), and click OK.
  5. The reset command can now be triggered with a single click, even if sheet grid interactions are frozen.

Diagnostic Tree: What to Check If the Reset Fails

If running the reset macro does not return Excel to normal, use this diagnostic sequence:

                  Excel Still Unresponsive After Reset Macro
                                      │
                   Are formulas failing to calculate?
                                     ╱ ╲
                               YES  ╱   ╲  NO
                                   ╱     ╲
         Check for Circular References   Is the UI or screen still frozen?
         or background calculation loops.              ╱ ╲
                                                 YES  ╱   ╲  NO
                                                     ╱     ╲
                        A modal loop or external    Check for hidden modal
                        COM add-in is blocking.     dialogs behind Excel.

1. Formulas Still Do Not Update

If .Calculation = xlCalculationAutomatic executed but formulas still show stale results:

  • Check for a Circular Reference. A circular reference stops the automatic calculation engine without displaying an error dialog every time. Go to Formulas > Error Checking > Circular References to see if an offending cell is listed.
  • If a macro triggered memory exhaustion during heavy calculation loops, see Troubleshooting “Out of Resources” during massive VBA loops.

2. Screen Remains Frozen or Does Not Repaint

If ScreenUpdating = True runs but the grid does not update:

  • Minimize and maximize the Excel window (Win + Down Arrow, then Win + Up Arrow). This forces the Windows desktop window manager to repaint the frame.
  • Check if a modal UserForm or an invisible dialog box is open behind the main application window. Press Esc or Alt + Space to bring hidden dialogs into focus.
  • For more on resolving UI freezes, review Handling “ScreenUpdating” and “Calculation” mode freezes.

3. Events Do Not Trigger

If worksheet change events remain inactive despite running the reset macro, an active procedure may be immediately setting EnableEvents = False again upon starting. Verify that your worksheet modules use proper event isolation as explained in Events Debugging: Why EnableEvents = False is necessary to prevent infinite loops.


Integrating Clean Exits Into Production Macros

A standalone reset macro is an emergency fallback. Your production procedures should handle their own cleanup automatically using an exit routing pattern:

Public Sub ProductionMacro()
    Dim previousCalc As XlCalculation
    previousCalc = Application.Calculation

    On Error GoTo ErrorHandler

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Application.EnableEvents = False

    ' Core business logic here...

RoutineExit:
    ' Guaranteed restoration block
    Application.ScreenUpdating = True
    Application.Calculation = previousCalc
    Application.EnableEvents = True
    Exit Sub

ErrorHandler:
    MsgBox "An error occurred: " & Err.Description, vbCritical, "Error"
    Resume RoutineExit
End Sub

For large projects with multiple procedures, centralize this exit and logging behavior by following Building a Global Error Handler: The Err.Number and Err.Description guide.