Excel Not Responding During VBA? Causes and Fixes

VBA & macros · Updated November 21, 2026

If Excel says Not Responding while VBA runs, it often means the macro is occupying Excel’s interface thread—not necessarily that Excel has crashed. Give it a moment if the task may be progressing; if it stays stuck, interrupt the macro safely and investigate long loops, recalculation, external calls, or event handlers before changing settings.

Why Excel appears frozen during VBA

Excel runs most VBA procedures synchronously: while a macro is executing, Excel may not be able to redraw its window or process ordinary clicks. Windows can then label the application Not Responding even though the code is still working. A large calculation, a loop over many cells, or a macro waiting on a file or network response can all produce this appearance.

The status alone does not tell you whether the macro is making progress. A task that updates thousands of cells may need time; a loop that never reaches its exit condition may run indefinitely. Repeatedly clicking the workbook or ending Excel immediately can make matters worse, especially if the macro is writing data. If the task is important, wait briefly and look for signs of activity such as changing CPU or disk use in Task Manager, while recognizing that those signs are not proof the code is healthy.

VBA itself does not automatically run its statements in parallel just because Excel supports multithreaded calculation for some worksheet formulas. A procedure that performs a great deal of work can therefore keep the interface busy. The aim is to determine whether the job is merely slow, blocked, or stuck, then make the smallest safe correction.

First steps to try safely

Before force-closing Excel, try to interrupt the running procedure. On Windows, press Ctrl+Break; on some keyboards you may need Fn with the Break or Pause key. On Mac, try Command+Period. If an interruption prompt appears, choose the option that stops the code. The exact response depends on the procedure and Excel’s interrupt settings, so these shortcuts are not guaranteed to work when Windows or Excel is completely blocked.

If Excel becomes responsive, save a copy of the workbook before experimenting. If it does not respond after a reasonable wait, you may have to end the process: use Ctrl+Shift+Esc to open Task Manager on Windows, select Microsoft Excel, and choose End task. On Mac, use Option+Command+Esc to open Force Quit. Unsaved changes can be lost, and a macro may have partially changed workbook data before it stopped. Reopen the file and check its contents rather than assuming the operation either completed or made no changes.

  • If the macro processes a large range, allow extra time before interrupting it.
  • If the workbook contains important unsaved work, avoid ending Excel until you have considered whether waiting or interrupting is possible.
  • After reopening, check whether Excel offers Document Recovery and review the recovered workbook carefully.

Find out where the macro is spending time

If you can reproduce the problem, use the Visual Basic Editor to identify the operation that is slow. In desktop Excel for Microsoft 365 on Windows, press Alt+F11 to open the editor. Start the macro with F8 to step through it one statement at a time, or set a breakpoint by clicking beside a code line and run the procedure. A breakpoint lets you inspect the code at that point; stepping through a long loop line by line is useful for diagnosis but will itself make the macro much slower.

Look at the last operation reached before Excel stops responding. A loop may be repeating without updating its counter, using the wrong ending row, or searching a range far larger than the data. An operation that reads or writes one cell at a time can also be slow on a large dataset. Repeatedly selecting cells or activating worksheets adds unnecessary work. A macro may instead be waiting for a workbook, file, database, or network resource that is unavailable.

For Mac, Excel also includes the Visual Basic Editor, although some Windows-specific debugging details and keyboard shortcuts differ. Excel for the web cannot run VBA macros; use desktop Excel to execute or debug them. If code depends on Windows-only components, such as certain COM automation or ActiveX controls, it may not work the same way on Mac.

Common causes and what to check

  • Very large loops: Check the loop bounds and termination condition. Confirm that the final row is based on the intended column and that the counter changes on every pass.
  • Cell-by-cell processing: Reading and writing individual cells repeatedly can be much slower than working with a range or an array. For large jobs, consider loading values into a VBA array, processing them in memory, and writing the result back in one operation.
  • Recalculation: Changes to cells can trigger expensive formulas, especially across large dependency chains. Volatile formulas and formulas in many worksheets may add to the delay.
  • Events firing repeatedly: A Worksheet_Change event can run again when its own code changes cells. That can create recursion or a cascade of work unless the event handler is designed to avoid it.
  • External dependencies: A macro that opens another workbook, communicates with an application, or accesses a network location can appear frozen while it waits for that resource.
  • Unexpected prompts: A dialog box may be hidden behind another window or outside the visible screen area. Check the taskbar and other open windows before concluding that code is stuck.

Do not assume that adding DoEvents is a universal fix. It yields time for Excel to process queued interface events, which may help a long-running routine remain more responsive. But it also allows other actions and events to occur while the procedure is in progress. If those actions change the workbook or start the same procedure again, they can introduce bugs. Use it deliberately, for example at occasional intervals in a long loop, and design the macro to handle interruption and re-entry.

Make a long macro safer and more responsive

For an appropriate macro, temporarily disabling screen updates, events, or automatic calculation can reduce overhead. These settings affect Excel beyond the current line of code, so the procedure should restore their previous values even when an error occurs. The example below changes cells in column B when column A contains Ready. Save a copy of the workbook before running it: macro changes cannot be undone with Ctrl+Z.

Sub MarkReadyRows()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim i As Long
    Dim oldScreenUpdating As Boolean
    Dim oldEnableEvents As Boolean
    Dim oldCalculation As XlCalculation
    Dim errorNumber As Long
    Dim errorDescription As String

    Set ws = ThisWorkbook.Worksheets("Data")
    oldScreenUpdating = Application.ScreenUpdating
    oldEnableEvents = Application.EnableEvents
    oldCalculation = Application.Calculation
    On Error GoTo Failed

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

    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    For i = 2 To lastRow
        If ws.Cells(i, "A").Value = "Ready" Then
            ws.Cells(i, "B").Value = "Processed"
        End If
    Next i
    GoTo Finish

Failed:
    errorNumber = Err.Number
    errorDescription = Err.Description

Finish:
    Application.Calculation = oldCalculation
    Application.EnableEvents = oldEnableEvents
    Application.ScreenUpdating = oldScreenUpdating
    If errorNumber <> 0 Then
        MsgBox "Macro stopped: " & errorDescription & _
            " (error " & errorNumber & ")"
    End If
End Sub

In this HTML code block, the displayed VBA comparison and concatenation operators are represented as < and & entities; when entering the procedure in the Visual Basic Editor, use the normal VBA operators <> and &. The macro assumes a worksheet named Data and headers in row 1. Change the sheet name and logic to match the workbook. Manual calculation can delay formula updates until calculation is restored, and restoring the original setting may trigger a substantial recalculation. Avoid disabling events if the workbook relies on event procedures to maintain important data.

For larger datasets, optimizing how the macro reads and writes values is often more effective than just suppressing screen redraws. Also consider whether the task can be divided into batches and whether users need to cancel it. DoEvents can provide opportunities to process a cancel request, but it does not make slow operations faster.

Check Excel, add-ins, and workbook conditions

If unrelated workbooks also freeze when macros run, investigate Excel itself and its add-ins. On Windows, close Excel, press Windows+R, type excel /safe, and press Enter to start Excel in Safe Mode. Then open a copy of the workbook and try the macro. If the issue disappears, an add-in or customization may be involved. In Excel, review File > Options > Add-ins; use the Manage list and Go button to review applicable add-ins, then test by disabling them one at a time. Re-enable trusted add-ins after the test.

If the issue affects one workbook only, test a copy of that file and check its formulas, links, event code, and workbook size. A damaged workbook is one possibility, but a large or unusually complex file can behave similarly. If Excel keeps failing across files, install available Microsoft 365 updates. If needed, use Windows Settings > Apps > Installed apps, select Microsoft 365, choose Modify, and try Quick Repair. Repair options vary by installation and organization policy.

Macro security and platform differences

Security settings can block macros or display a warning, but a blocked macro is different from one that is actively running and making Excel unresponsive. Do not enable all macros simply to test a workbook. On Windows, inspect File > Options > Trust Center > Trust Center Settings > Macro Settings and follow your organization’s policy. Only run code from a source you trust, and check whether a file downloaded from the internet has been marked as blocked.

Desktop Excel for Mac supports VBA, but code that relies on Windows APIs, COM automation, or ActiveX may need a different implementation. Excel for the web does not execute VBA; macros must be run in a desktop version of Excel. If a workbook is shared across platforms, document which desktop versions and dependencies its macros require.

Prevent the problem next time

Test changes on a copy with a small sample before running a macro on a large workbook. Add clear progress messages or a status-bar update for lengthy tasks, and make sure loop conditions have a reliable end. For recurring work, record the number of rows processed and log errors so a partial run can be investigated. Avoid suppressing all alerts or errors without a clear reason; a hidden prompt can make a macro look stalled and conceal a failed operation.

Before running a macro, save the workbook and confirm that it is the intended file. When a procedure changes many records, consider preserving the original data or writing results to a separate sheet. This makes it easier to compare the output and recover from a logic mistake than relying on Excel’s undo history, which does not undo VBA operations.

Frequently Asked Questions

Is Excel actually frozen if it says Not Responding?
Not always. Excel may be busy executing VBA and unable to refresh its interface. If it remains unresponsive for a long time, the procedure may be stuck, waiting on an external resource, or overwhelmed by calculation.

How do I stop a VBA macro that is running?
On Windows, try Ctrl+Break, sometimes with Fn on compact keyboards. On Mac, try Command+Period. If Excel cannot respond to an interrupt, you may have to end the application, which can discard unsaved changes.

Will Ctrl+Z undo a macro?
No. Running VBA generally clears Excel’s normal undo history, and Ctrl+Z cannot reverse the macro’s changes. Save a separate copy before running code that edits workbook data.

Does DoEvents fix Excel freezing?
It can let Excel process pending interface events during a long routine, but it does not correct an infinite loop or make inefficient code faster. Because other events can run while the macro is yielding, use it only when the code can safely handle that behavior.

Can Excel for the web run VBA?
No. Open the workbook in desktop Excel for Microsoft 365 on Windows or a supported desktop Mac version to run VBA. Platform-specific code may still need changes to work on both systems.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.