Macros are small programs that automate repetitive tasks in Excel, but by default, Excel blocks them for security reasons. Unblocking macros lets you run trusted VBA code, but it also carries risk—macros can contain malicious code. This guide shows you how to safely unblock macros in Excel for Microsoft 365 on Windows, with notes for Mac and Excel for the web.
What You’ll Need
- An Excel workbook (.xlsm or .xlsb) that contains macros
- Access to the file’s location (local drive, network, or email attachment)
- Confidence that the macro source is trustworthy (e.g., from a colleague, not an unknown sender)
Step-by-Step
- Open Excel and go to the Trust Center. Click File > Options (at the bottom left). In the Excel Options dialog, select Trust Center from the left pane, then click Trust Center Settings….
- Adjust Macro Settings. In the Trust Center, choose Macro Settings from the left. You’ll see several options. To unblock macros for this session or permanently, select Enable all macros (not recommended for everyday use) or Disable VBA macros with notification (recommended—this lets you enable macros per file when prompted). Click OK twice to close the dialogs.
- Open the workbook. When you open a macro-enabled file, Excel may show a yellow security warning bar with an Enable Content button. Click it to unblock macros for that file only. If the bar doesn’t appear, check if macros are already enabled or if the file is in a trusted location.
- Unblock a single file via Properties (Windows only). If the file came from the internet (e.g., email or download), right-click the file in File Explorer, select Properties, and check the Unblock box at the bottom of the General tab. Click Apply and OK. This removes the Mark of the Web, so Excel no longer treats it as risky.
- Add a trusted folder (optional). To avoid prompts for files you trust, go to File > Options > Trust Center > Trust Center Settings > Trusted Locations. Click Add new location…, browse to the folder containing your macro files, and enable Subfolders of this location are also trusted if needed. Click OK.
- For Mac (Excel for Microsoft 365): Go to Tools > Protect Sheet (not relevant) — actually, go to Excel menu > Preferences > Security. Under Macro Security, choose Enable all macros or Prompt for action. Then open the file and click Enable Macros when prompted. For a single file, you can also right-click the file in Finder, select Open, and then confirm you want to open it (this bypasses the quarantine).
- For Excel for the web: Macros are not supported in the browser version. You must open the file in the desktop app to run macros. Click Edit in Browser won’t help; instead, click Open in Desktop App from the ribbon.
Common Mistakes
- Enabling all macros permanently—this leaves your system vulnerable. Use the notification option instead.
- Forgetting to unblock the file in Properties—even if you enable macros in Excel, the Mark of the Web can still block them.
- Trusting a macro from an unknown source—always verify the sender and the code if possible.
- Not saving as .xlsm—if you save as .xlsx, macros are stripped. Ensure the file extension is .xlsm or .xlsb.
- Thinking macros are unblocked after disabling Protected View—Protected View is separate; you still need to enable content.
Tips
- Use Digital Signatures: If you trust the developer, add their certificate to Trusted Publishers. Then macros run without prompts.
- Review the VBA code before running: Press Alt+F11 to open the VBA editor and inspect the modules. Look for suspicious commands like
ShellorDeleteFile. - Keep macros disabled by default and enable only for files you know are safe.
- If you frequently work with macros, create a dedicated folder and add it to Trusted Locations to skip prompts.
- Back up your workbook before running a macro that modifies data—macros cannot be undone with Ctrl+Z.
Troubleshooting
Macros still blocked after enabling? Check the file’s Properties (Windows) to ensure the Unblock box is checked. Also, confirm the file is not in a Protected View (look at the top bar). If it says “Protected View,” click Enable Editing first.
No “Enable Content” button appears? This happens when macros are fully disabled in Trust Center. Go to File > Options > Trust Center > Macro Settings and choose Disable VBA macros with notification.
Error “Cannot run the macro because macros are not available in this workbook”? The file might be saved as .xlsx. Re-save as .xlsm via File > Save As and choose “Excel Macro-Enabled Workbook”.
Macros work on your PC but not on a colleague’s? The other user may have stricter security settings. Ask them to follow the same steps or add the file to their trusted locations.
On Mac, the file opens but macros are grayed out? Go to Excel > Preferences > Security and ensure “Enable all macros” or “Prompt for action” is selected. Also, check if the file is from the internet—right-click and choose Open to bypass quarantine.
Excel for the web shows “Macros are disabled”? That’s expected—macros only run in the desktop app. Click Open in Desktop App.
Frequently Asked Questions
Q: Is it safe to enable all macros?
A: No. Malicious macros can harm your computer. Use “Disable with notification” and enable only for trusted files.
Q: How do I know if a macro is safe?
A: Check the source, and if possible, view the VBA code (Alt+F11) to see what it does. Look for file deletion, network calls, or obfuscated code.
Q: Can I unblock macros without changing Excel settings?
A: Yes, for a single file, right-click the file in File Explorer, select Properties, and check Unblock (Windows). On Mac, right-click and choose Open.
Q: Why does Excel block macros by default?
A: To prevent malicious code from running automatically. Microsoft enables this security feature by default.
Q: Will unblocking macros affect the file’s content?
A: No, it only allows the VBA code to run. The data remains unchanged.
Q: Can I unblock macros in a .xls file?
A: Yes, the same steps apply, but .xls files are older format; consider converting to .xlsm.
Related
- Balloon Payment Calculator with Set Payment
- PostgreSQL Number to String: Casting and Formatting
- Progress Notes and Charting: A Complete Guide
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- VBA Scripting.Dictionary: How It Works and How to Use ItA VBA Scripting.Dictionary stores data as unique keys paired with values, so code can look up an item…
- Excel VBA Array Append: Safe Methods and ExamplesTo append a value to a one-dimensional Excel VBA array, increase its upper bound with ReDim Preserve, then…
- VBA Loop Through a PivotTable: Examples and TipsTo loop through a PivotTable in Excel VBA, assign it to a PivotTable variable and use a For…
- Macro Cell Site: Definition, How It Works, and UsesA macro cell site is the large cellular base station that provides the main wireless coverage in a…
- VBA Function Statement: Syntax, Scope, and ExamplesThe VBA Function statement declares a procedure that performs a task and returns a value. You can call…
- Trim Excel Macro: Clean Extra Spaces in Selected CellsIf the text is in A2, enter =TRIM(A2) in another cell to remove leading and trailing ordinary spaces…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.