How to Enable Macros in Excel on Windows and Mac
To enable macros in Excel, open your workbook and click Enable Content on the security warning bar, provided you know and trust the file’s source.
If Excel does not display this button, you may need to review its macro security settings or unblock a trusted workbook downloaded from the internet.
I recommend enabling macros for individual workbooks rather than changing Excel’s settings to allow every macro automatically. Macros can automate repetitive spreadsheet tasks, but malicious VBA code can also compromise your computer.
Not every spreadsheet task requires a macro. For example, you can remove duplicates in Excel using built-in tools without enabling VBA. Macros become particularly useful when you need to automate repetitive tasks involving multiple operations.
The following methods cover Microsoft 365, Excel 2024, 2021, 2019 and other recent desktop versions.
Which Method Should You Use to Enable Macros?
Before changing any settings, check the message or restriction you are experiencing.
| Excel warning or problem | Recommended solution |
|---|---|
| Yellow security warning | Select Enable Content for a trusted workbook |
| Red Security Risk warning | Verify the source and unblock the individual file |
| No macro security notification | Review Trust Center settings |
| Macro settings are greyed out | Contact your IT administrator |
| Macros unavailable in Excel Online | Open the workbook in desktop Excel |
| Macros disappeared after saving | Check the workbook’s file format |
Choosing the appropriate method can save you from unnecessarily weakening Excel’s security settings.
How to Enable Macros in a Single Excel Workbook
When you open a workbook containing VBA macros, Excel may display a yellow security warning below the ribbon stating that macros have been disabled.
To allow the macros to run:
- Open the macro-enabled workbook in desktop Excel.
- Locate the security warning above the spreadsheet.
- Click Enable Content.
- Confirm that you trust the document if an additional warning appears.
Excel may remember your decision and treat the workbook as a trusted document when you open it again.
Enable macros for one session only
You do not have to trust a workbook permanently.
When the relevant options are available:
- Click File > Info.
- Select Enable Content.
- Choose Advanced Options.
- Select Enable content for this session.
- Click OK.
The active content is enabled for the current session rather than permanently trusting the workbook.
This is a useful option when working with a verified spreadsheet that you only need to open occasionally.
How to Enable Macros in Excel on Windows 10 and 11
If Excel automatically disables macros without displaying a notification, check its Trust Center configuration.
- Open Microsoft Excel.
- Click the File tab.
- Select Options near the bottom of the menu.
- Click Trust Center in the Excel Options window.
- Select Trust Center Settings.
- Click Macro Settings in the left-hand menu.
- Select Disable VBA macros with notification.
- Click OK, then close the Excel Options window.

Close and reopen the workbook. If no additional security restrictions apply, Excel should display a notification allowing you to enable its macros.
Although selecting Disable VBA macros with notification may sound counterintuitive, it allows you to decide which workbooks can execute VBA code without automatically trusting every file.
Understanding the four Excel macro security settings
| Macro setting | What it does |
|---|---|
| Disable VBA macros without notification | Prevents macros from running without displaying a warning |
| Disable VBA macros with notification | Blocks macros initially but allows approval for eligible workbooks |
| Disable VBA macros except digitally signed macros | Restricts execution based on digital signatures and publisher trust |
| Enable VBA macros | Allows macros to execute without the usual approval prompt |
I recommend the second option for everyday spreadsheet work.
The last option is potentially dangerous because it permits VBA code to run without the normal confirmation process, although other security policies may still apply.
You should also leave Trust access to the VBA project object model disabled unless a legitimate development tool specifically requires it. This setting is not necessary for running ordinary Excel macros.
How to Enable Macros When Microsoft Has Blocked Them
You may encounter a red warning containing the following message:
“Microsoft has blocked macros from running because the source of this file is untrusted.”
Unlike the ordinary yellow security warning, this message does not provide an Enable Content button.
This commonly happens when you download a macro-enabled spreadsheet from a website, receive one as an email attachment or obtain it through another internet-based service.
Windows can attach security information called Mark of the Web to downloaded files. Excel uses this information when deciding whether to block macros.
If you have independently verified the workbook’s source and trust its contents, you can remove this restriction from the individual file.
Unblock a trusted Excel file
- Close the workbook in Excel.
- Open File Explorer and locate the downloaded file.
- Right-click the file and choose Properties.
- Open the General tab.
- Locate the Security section near the bottom.
- Select the Unblock checkbox.
- Click Apply, followed by OK.
- Reopen the workbook in Excel.
Depending on your macro security settings, Excel may now display the ordinary security notification.
Do not unblock a workbook simply because its instructions tell you to enable macros. Verify unexpected attachments with the sender through a separate communication channel, and obtain confirmation from your IT department where required.
Microsoft’s official guidance on blocked internet macros explains the underlying security restrictions.
How to Enable Macros in Excel on Mac
Excel for macOS has its own macro security preferences rather than the Windows Trust Center interface.
To review these settings:
- Open Excel on your Mac.
- Click Excel in the macOS menu bar.
- Select Preferences, or Settings if shown in your version.
- Open Security.
- Select Disable all macros with notification.
- Close the preferences window.
- Reopen your trusted macro-enabled workbook.
- Approve the macro security prompt when it appears.
Avoid enabling all macros permanently.
Also remember that macros created in Windows may contain Windows-specific components, such as ActiveX controls or Windows API calls. Enabling macros on your Mac does not guarantee that such code will work correctly.
How to Access Macro Settings From the Developer Tab
If you regularly work with VBA, the Developer tab provides a convenient shortcut to Excel’s macro security controls.
On Windows, enable the Developer tab by following these steps:
- Click File > Options.
- Open Customize Ribbon.
- Locate Developer under Main Tabs.
- Select its checkbox.
- Click OK.
The Developer tab should now appear on the Excel ribbon.
Select Developer > Macro Security whenever you need to review your security configuration.
Enabling the Developer tab does not automatically enable macros. It simply makes development and automation tools easier to access.
How to Check Whether Excel Macros Are Working
After enabling macros in a verified workbook, you can check whether an existing macro is available.
On Windows:
- Open the workbook.
- Press Alt + F8.
- Find the intended macro in the list.
- Select it and click Run, provided you understand and trust what it does.
Alternatively, use Developer > Macros.
Not every VBA procedure appears in this list. Some macros run automatically when the workbook opens, while others are attached to buttons or worksheet events.
If an approved macro starts but displays a runtime or compilation error, macro security may no longer be the problem. The VBA code itself could contain an error, missing reference or incompatible function.
If your macro runs successfully but spreadsheet values remain unchanged, the problem could be related to Excel’s calculation settings. My guide on how to fix Excel formulas not calculating explains how to diagnose and resolve calculation problems.
Can You Enable Macros in Excel Online?
No. Excel for the web does not support creating, editing or executing traditional VBA macros.
You can open and edit supported macro-enabled workbooks in your browser, but you need desktop Excel to execute their VBA code.
Look for Open in Desktop App when viewing the workbook through Microsoft 365.
Office Scripts provide a separate spreadsheet automation option for supported Microsoft 365 accounts. However, Office Scripts cannot directly execute existing VBA macro code.
Why Are Macros Still Not Working in Excel?
If you have followed the appropriate instructions but the macros remain unavailable, investigate these additional problems.
The workbook has the wrong file format
Excel’s standard .xlsx format cannot store VBA macro code.
Common macro-compatible formats include:
| File extension | Supports VBA macros? |
|---|---|
| .xlsx | No |
| .xlsm | Yes |
| .xlsb | Yes |
| .xls | Yes |
| .xltm | Yes |
When saving a workbook containing macros, choose File > Save As and select Excel Macro-Enabled Workbook (*.xlsm) if appropriate.
Changing the file format will not recover macros that were already removed when the workbook was saved as an .xlsx file. You will need the original macro-enabled version or another backup.
The worksheet is protected
Some macros modify cells, delete rows or update existing records. If the worksheet is protected, these operations may fail even when macros are enabled.
Understanding how to lock and protect rows in Excel can help you identify whether worksheet protection is preventing your macro from completing its intended task.
Freezing rows does not prevent macros from modifying them. Worksheet protection, however, can restrict certain operations depending on how it has been configured.
If you own the workbook or have permission to modify it, review its protection settings under the Review tab.
The workbook is in Protected View
Protected View restricts editing and other potentially unsafe activities in files from untrusted locations.
An Enable Editing button is not the same as an Enable Content button.
Only leave Protected View after verifying that the workbook is legitimate. Macro restrictions may remain active even after editing becomes available.
Macro security settings are greyed out
An employer or school may enforce macro security restrictions through centrally managed policies.
These restrictions can override your personal Excel preferences.
Contact your IT administrator and explain which legitimate workbook or business process requires macro access. Do not attempt to bypass organizational security controls.
The macros require an older Excel feature
Some legacy spreadsheets use Excel 4.0 macros, also called XLM macros, rather than modern VBA.
Recent versions of Excel have additional restrictions for these older macros.
I recommend asking the workbook’s developer for an updated version rather than enabling legacy macro support without understanding the security implications.
What Is the Safest Way to Keep Excel Macros Enabled?
For most people, the best configuration is to disable VBA macros with notification and approve only trusted workbooks.
If you regularly use macro-enabled spreadsheets for business, consider digitally signed macros from verified publishers or an administrator-managed Trusted Location.
Be especially careful with Trusted Locations because files stored there can bypass important security checks. Never designate your entire Downloads folder as trusted.
Excel macros are powerful automation tools. You can benefit from them without exposing every spreadsheet you open to unrestricted VBA execution.