To turn on macros in Excel, click Enable Content on the yellow security warning bar under the ribbon. If the bar is red and has no such button, close the file, right-click it in File Explorer, open Properties, tick Unblock, and reopen it.
Which method applies depends on what Excel shows when you open the file. Only enable macros in files you trust. If you are not sure what a macro is, what macros are covers the basics.
Enable macros from the yellow security warning bar
- Open the workbook. A warning bar appears saying macros have been disabled.
- Select Enable Content.
- If a Security Warning dialog appears, click Yes to mark the document as trusted.
The file is now a Trusted Document, and its macros run. You don't need to enable macros just to view or edit a file.
Fix the red "Security Risk" banner (no Enable Content button)
On Windows, Office blocks macros in files from the internet. Browser downloads and email attachments carry a Windows marker called Mark of the Web. When Excel opens such a file, it shows a Security Risk banner saying the source of the file is untrusted. Unlike the yellow bar, this banner has a Learn More button but no Enable Content button. Microsoft's documentation says this applies to Access, Excel, PowerPoint, Project, Publisher, Visio and Word on Windows.
To unblock a file you trust:
- Close the workbook.
- In File Explorer, right-click the file and choose Properties.
- On the General tab, tick Unblock, then select OK.
- Open the file again.
This removes Mark of the Web from your local copy. It works only if no policy or Trust Center setting is blocking macros. In PowerShell, Unblock-File does the same thing as the checkbox:
Unblock-File -Path "C:\work\report.xlsm"
Replace the path with your file. Microsoft describes the cmdlet as removing the ZoneId value from the file, which does the same as ticking Unblock.
If there is no Unblock checkbox
Files on a network share sometimes show no Unblock checkbox. Even when it is there, it has no effect if the share is treated as being in the Internet zone. Microsoft's options are to designate the location as a Trusted site or, for an intranet location, add it to the Local intranet zone. A share opened by its IP address is blocked unless it is in one of those zones. Both changes give the location broader trust than Office alone, so ask your IT team before doing this.
Files from OneDrive or SharePoint
Per Microsoft, a file opened from the OneDrive website or a SharePoint site with Open in Desktop App won't have Mark of the Web. A file downloaded through a web browser might, depending on your Windows internet security zone settings. If you downloaded the file, use the Unblock steps above.
Change macro settings in the Trust Center
- Go to File > Options > Trust Center, then select Trust Center Settings.
- Select Macro Settings.
- Choose an option and select OK.
If the Developer tab is on your ribbon, Macro Security there opens the same page. Changes apply only to the app you are using.
| Setting (Excel wording) | What it does |
|---|---|
| Disable VBA macros without notification | Macros are off and Excel does not offer to turn them on. |
| Disable VBA macros with notification | Macros are off, and the warning bar lets you enable them. This is the default. |
| Disable VBA macros except digitally signed macros | Only macros signed by a trusted publisher run. |
| Enable VBA macros (not recommended; potentially dangerous code can run) | All macros run with no prompt. |
In Excel the word "all" is replaced by "VBA", and the settings apply only to VBA macros. Excel also has a checkbox, Enable Excel 4.0 macros when VBA macros are enabled. Choosing the last option does not override the internet block described above: Microsoft says unblocking works only if no policy or Trust Center setting is blocking.
Trust a folder instead: Trusted Locations
A Trusted Location is a folder for files you trust. Microsoft says files saved there from the internet skip the Mark of the Web check and open with VBA macros enabled, so you don't need to use Unblock each time. You add folders in the Trust Center under Trusted Locations. Use this sparingly and choose a folder only you can write to. Microsoft recommends against making network locations trusted.
If macros still don't run
- Your organization manages the device. An administrator may block changes to macro settings, and Microsoft notes that policies are only available for Microsoft 365 Apps for enterprise.
- The file is a template or add-in. Downloaded macro-enabled templates (
.xlt,.xltm) and Excel add-ins (.xla,.xlam) with Mark of the Web are blocked too. Unblock the file, then reopen Excel. For add-ins, Microsoft says a digital signature doesn't help while the marker is present. - The settings page shows a stricter option. If it is set to Disable VBA macros without notification, no bar will appear. Change it to the notification option.
Frequently asked questions
- Why is there no Enable Content button in Excel?
- On Windows, Office blocks macros in files from the internet, such as downloads and email attachments. Those files show a Security Risk banner without an Enable Content button. Close the file, right-click it in File Explorer, choose Properties, tick Unblock on the General tab, select OK, and open it again.
- Is it safe to enable macros in Excel?
- Only if you trust where the file came from. Microsoft states that VBA macros are a common way for attackers to deploy malware and ransomware. You don't need to enable macros just to view or edit a file.
- Does Excel on Mac or Excel for the web block macros the same way?
- The internet-macro blocking described here affects Office on Windows only. Microsoft states that it doesn't affect Office on a Mac, on Android or iOS, or Office on the web.
- Can I turn macros on for every Excel file?
- Yes, by choosing the Enable VBA macros option in the Trust Center, but Microsoft labels it not recommended because potentially dangerous code can run. A safer option is to save trusted files in a Trusted Location.
- Why can't I change the macro settings?
- If your organization manages your device, an administrator may block these changes. Microsoft notes that policies can control macro behavior, so ask your IT team.