Excel Macro Not Working? How to Find the Cause
An Excel macro that won't run is almost always blocked, disabled, closed, or saved as .xlsx. Match your symptom below to the cause, then apply the fix.
2026-09-24
Why your Excel macro is not working
An Excel macro that will not run is almost never broken code. Nine times out of ten it is blocked, disabled, sitting in a closed workbook, or was lost when the file was saved as .xlsx. The quickest route to a fix is to match what you are seeing to the cause, rather than changing settings until something works.
Resist the common online advice to switch on Enable VBA macros and tick every Trust Center box. It can make the symptom vanish, by removing protection from every workbook you will ever open.
TL;DR: Key takeaways
- Red bar, no button: the file is blocked. Unblock it in Properties.
- Nothing happens, no bar: macros are disabled silently. Switch to "with notification".
- Macro missing from the list: the workbook holding it is closed.
- Macro gone after saving: the file was saved as
.xlsx. - Do not fix any of these by enabling all macros.
Match the symptom to the cause
| What you see | Likely cause | Fix |
|---|---|---|
| Red bar, no Enable button | File downloaded from the internet | Unblock in file Properties |
| No bar, nothing runs | Macros disabled without notification | Change the Trust Center setting |
| Macro not in the Alt + F8 list | Its workbook is closed, or the list is filtered | Reopen it; set Macros in to All Open Workbooks |
| Macro vanished after saving | File saved as .xlsx | Resave as .xlsm from a copy that still has it |
| Shortcut or button stopped working | Workbook holding the macro is closed | Store it in the Personal Macro Workbook |
| Startup macro never fires | Code is in a normal module | Move it into ThisWorkbook |
| Recorded macro skips new rows | Recorded range is fixed | Re-record or widen the range |
| Error dialog mid-run | A line of the code failed | Click Debug to see which one |
| Nothing in the browser | Excel for the web cannot run VBA | Open in desktop Excel |
The sections below cover the four causes behind most reports.
Blocked: the red bar with no button
A red bar saying Microsoft blocked macros because the source is untrusted means the file carries an internet marker. No setting inside Excel will help.
Close the workbook, right-click the file in File Explorer, choose Properties, tick Unblock, and reopen. Enabling macros when there is no enable button covers the Mac and IT-policy cases.
Disabled silently: nothing happens at all
No bar, no prompt, nothing happens. That points at Disable VBA macros without notification, which blocks every macro silently.
Go to File > Options > Trust Center > Trust Center Settings > Macro Settings and choose Disable VBA macros with notification. Microsoft's settings guide describes each option, and what each macro setting does explains why this one, not "enable all", is the right choice.
Missing: not in the macro list
Alt + F8 only lists macros from workbooks that are currently open. If the file holding the macro is closed, it is not in the list, and any shortcut or button pointing at it does nothing.
Reopen that workbook, and check the Macros in dropdown is set to All Open Workbooks. If you want a macro available everywhere without keeping a file open, put it in your Personal Macro Workbook. Running a macro you downloaded covers the list itself in more detail.
Gone: the macro disappeared after saving
A .xlsx file cannot store VBA. Save a macro workbook as .xlsx, confirm the warning, and every macro in the new file is deleted.
The code survives only in an earlier .xlsm copy or a .bas export. XLSM vs XLSX explains which format to use.
When the macro errors partway through
A dialog with End and Debug buttons means the code ran and one line failed. Click Debug and the VBA editor opens with that line highlighted, which usually makes the problem obvious: a missing sheet, an empty selection, a merged cell.
To watch a macro run one line at a time, open the editor, place the cursor in it and press F8. Microsoft documents this as the way to step through code. If the error appears on the very first line and mentions Attribute, the code was pasted from a .bas file, and importing it properly fixes it.
Frequently asked questions
Why are my macros not working even though they are enabled?
Usually because the file itself is blocked, which ignores your macro settings entirely. A downloaded workbook shows a red bar with no button no matter what the Trust Center says. Unblock the file in its Properties and reopen it.
Why did my macro stop working suddenly?
The three usual causes are a closed workbook that held the macro, a file resaved as .xlsx, or an Office update or reinstall that reset your settings. Check the macro still appears under Alt + F8, then check the file extension.
Should I enable all macros to fix it?
No. It removes the prompt for every workbook from every source, and it does not fix a blocked download anyway. Choose Disable VBA macros with notification and trust specific files or folders instead.
Why does my macro work on my computer but not a colleague's?
Macros stored in your Personal Macro Workbook live on your machine only. Their Excel may also have different macro settings, or their copy of the file may be blocked. Send the .xlsm that contains the code and have them unblock it, or package it as an add-in.
Can a macro run in Excel for the web?
No. Excel for the web cannot create, run, or edit VBA macros. The file opens and the data is visible, but the code does nothing until it is opened in desktop Excel.
What to do next
Start with the table: most problems are in its first four rows, and none need a setting weakened. If yours is a startup macro that never fires, running a macro automatically when a workbook opens covers the ThisWorkbook detail. For a shortcut or button that stopped responding, see running a macro from a button or shortcut.