Excel guide · 4 min read
How to enable macros in Excel
Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | |
|---|---|---|---|
| 1 | What you see | What it means | What to do |
| 2 | Yellow bar: Macros have been disabled | Normal default for a file with macros | Enable Content if you trust it |
| 3 | Red bar: Microsoft has blocked macros | File carries the internet mark | Properties > Unblock, if you trust it |
| 4 | Yellow bar: Protected View | Downloaded or emailed file | Enable Editing first, then Enable Content |
| 5 | No bar, macros never run | Disable without notification, or IT policy | Check Macro Settings, ask IT |
| 6 | Macros gone after saving | Saved as .xlsx | Save as .xlsm from your backup copy |
| 7 | Opened in a browser | Excel for the web doesn't run VBA | Open in the desktop app |
1. Yellow bar: Enable Content
When a workbook with macros opens, Excel's default setting disables them and shows a yellow SECURITY WARNING bar: Macros have been disabled. Clicking Enable Content turns them on and marks the file as a trusted document, so it won't ask again for that file on this computer.
If the bar also says Protected View, click Enable Editing first. The Enable Content button appears after that. Our guide to Protected View covers that step in detail.
If you closed the bar without choosing, go to File > Info, click Enable Content in the Security Warning section and choose Enable All Content.
2. Red bar: Microsoft has blocked macros
Files downloaded from the internet or saved from an email carry a mark from Windows. Excel blocks macros in those files completely and shows a red SECURITY RISK bar with no Enable button. This is deliberate: malicious macros usually arrive this way.
If the file came from someone you know and you were expecting it, remove the mark:
- Close the workbook in Excel.
- In File Explorer, right-click the file and choose Properties.
- On the General tab, tick Unblock next to Security at the bottom. If there's no Unblock box, the file isn't marked.
- Click OK and open the file again. You'll now get the normal yellow bar with Enable Content.
3. Your macros disappeared after saving
A normal .xlsx workbook can't contain macros. When you save a workbook with VBA code as .xlsx, Excel warns that the VB project can't be saved in a macro-free workbook. Click Yes and the file is saved with the code stripped out.
Use File > Save As and choose Excel Macro-Enabled Workbook (*.xlsm), or Excel Binary Workbook (*.xlsb). If the code is already gone from the .xlsx, it's not hiding in there: go back to an older copy, File > Info > Version History for files in OneDrive or SharePoint, or the original you were sent.
Your own everyday macros can live in the Personal Macro Workbook (PERSONAL.XLSB), which opens hidden with Excel, so you don't need to save them into each report.
4. No bar at all: check Macro Settings
If macros never run and no bar appears, look at File > Options > Trust Center > Trust Center Settings > Macro Settings. The default, Disable VBA macros with notification, is the right one: it shows the yellow bar and lets you decide per file. "Disable VBA macros without notification" blocks them silently, which is why nothing shows.
Don't choose Enable VBA macros. It runs every macro in every file without asking, including ones you never meant to open. On a work computer, these options may be greyed out because your IT team sets them; in that case, ask them, as they may have a signed or approved route for the macros you need.
5. Trusted Locations for your own macro files
If you open the same macro workbooks every day, a trusted location saves clicking: files opened from that folder run macros without the bar. Go to Trust Center Settings > Trusted Locations > Add new location and pick one folder that only you save into, such as Documents\Macros.
Never add Downloads, the desktop, a shared drive everyone writes to, or a whole drive. Anything that lands in a trusted location runs without warning.
Two more things to know. Excel for the web opens .xlsm files but doesn't run VBA macros, so use the desktop app. And you don't need the Developer tab to run a macro: View > Macros, or Alt+F8, lists them.
Common mistakes
Setting Enable VBA macros to stop the warnings
Keep Disable with notification and enable per file, or use one trusted folder you control.
Saving a macro workbook as .xlsx
The code is removed. Save as .xlsm (or .xlsb) and recover the code from an earlier copy.
Unblocking a file because it asks you to
"Enable macros to see the content" is a common trick. Only unblock files you expected, from someone you know.
Adding Downloads as a trusted location
Every downloaded file would run macros silently. Choose a folder only you save into.
FAQ
How do I enable macros in Excel permanently?
Enable Content once on a file you trust and Excel remembers that file. For a set of your own files, store them in one trusted location. Turning on all macros for every file isn't recommended.
Why is there no Enable Content button?
The file has the internet mark, so macros are blocked and the bar is red. Close it, tick Unblock in its Properties, and reopen. Or the file is in Protected View: click Enable Editing first.
Why can't I save macros in my Excel file?
.xlsx files can't hold macros. Use File > Save As and pick Excel Macro-Enabled Workbook (.xlsm).
Do macros work in Excel online?
No. Excel for the web doesn't run VBA macros. Open the workbook in the Excel desktop app to run them.
Is it safe to enable macros?
Only for files from people you trust that you were expecting. A macro can change files, send data or install software, so treat an unexpected macro file like a suspicious email attachment.
Related guides
- Excel Protected View: why you can't edit and how to fix it
- How to remove read-only from an Excel file
- Excel ribbon missing: how to get it back
- Fix "Excel cannot open the file because the file format or file extension is not valid"
- Excel scroll bar too small: how to fix it
- Excel gridlines not showing: how to get them back
Updated