How to Enable Macros in Excel (Every Method, Step by Step)
Written by the team at Iron Software
Macros are a powerful feature in Microsoft Excel that allow users to automate repetitive tasks and streamline workflows. If you’ve ever opened an Excel file and seen a yellow bar at the top saying “Macros have been disabled,” you’re not alone. This happens to millions of Excel users every day and the fix usually takes less than ten seconds.
Macros work by automating tasks within an Excel spreadsheet. They are composed of commands, which can be recorded actions or VBA code, to perform specific functions automatically.
A macro is a series of commands that can be executed as a single command in Excel.
The quickest way: Click the Enable Content button in the yellow Security Warning bar that appears just below the ribbon. That’s it. Your macros will run immediately.
But there’s more to the story. Depending on how your file arrived (email, shared drive, IT policy), that button might not appear or you might need macros to run automatically without any prompt at all. This guide covers every method, every edge case, and every setting you might need. *
What Are Macros, and Why Does Excel Block Them?
Macros are small programs recorded or written inside an Excel file that automate a task or multiple tasks, things like formatting a weekly report, importing data from another sheet, or sending an email when a cell hits a certain value. They’re genuinely useful.
Macros can be used to automate complex or repetitive tasks in Excel.
Macros can help simplify work with the Excel spreadsheet program.
The reason Excel blocks them by default is that macros can be used to run malicious code. A virus or ransomware payload can hide inside a macro-enabled Excel file (.XLSM), so Microsoft decided it was safer to block all macros unless you explicitly allow them. This is a good policy in general, it just means you need to know how to turn macros on for files you do trust.
Method 1: Click "Enable Content" in the Security Warning Bar (Fastest)
This is the most common scenario and the fastest fix.
When you'll see this: Any time you open a macro-enabled Excel file (.XLSM or .XLSB) that hasn't been opened on your machine before.
Steps:
- Open the Excel file as you normally would.
- Look just below the ribbon tabs, you'll see a yellow bar with a shield icon and the message: "SECURITY WARNING: Macros have been disabled."
-
Click the Enable Content button on the right side of that bar.
- The file reloads with macros active.

What this does behind the scenes: Excel adds the file to your list of trusted documents. The next time you open the same file from the same location, macros will run automatically with no prompt.
Important caveat: If you move or copy the file to a different folder, or receive a fresh copy via email, Excel may treat it as a new untrusted file and prompt you again. *
Method 2: Enable Macros via Excel Trust Center Settings
If you want macros to run automatically in all files or you want to fine-tune how Excel handles macros globally, you can change macro settings in the Trust Center. To do this, you need to select Trust Center from the Excel Options window.
When to use this: You work with macro-enabled files regularly, and the yellow bar is getting in the way.
Steps:
- Open Excel (no file needs to be open for this).
-
Click File in the top-left corner.
-
Click Options at the bottom of the left panel.
-
In the Excel Options window, select Trust Center in the left sidebar.
-
Click the Trust Center Settings… button on the right.
-
Click Macro Settings in the left panel of the Trust Center window.
- Choose one of the four options (see breakdown below).
- Click OK, then OK again to close both windows.
The Trust Center in Excel contains all the security as well as privacy settings used to keep your computer secure.
Changing macro settings in the Trust Center can be risky, especially in a managed environment. If your device is managed by your work/school, the system administrator might prevent anyone from changing macro settings.
In the Trust Center, you can set macro permissions on a case-by-case basis, make a file a trusted document, and configure trust access to the VBA project object model to control how Excel handles macros and prevent unauthorized code execution.
The Four Macro Settings Explained
| Setting | What It Does | Who Should Use It | | --- | --- | --- | | Disable all macros without notification | Macros are silently blocked, no yellow bar | High-security environments, shared/public computers | | Disable all macros with notification (Default) | Shows the yellow bar, you decide per file | Most everyday users | | Disable all macros except digitally signed macros | Allows macros from verified publishers only | Corporate environments with signed macro tools | | Enable all macros | All macros run automatically, no prompts | Power users who only open trusted files |
For most office workers, leaving it on the default ("Disable with notification") and clicking Enable Content per file is the safest workflow.
Method 3: Add a Folder to Trusted Locations
If your team shares macro-enabled files from a specific network drive or folder, you can tell Excel to always trust files from that location, no yellow bar, no prompts, just open and go.
When to use this: You have a shared team folder (like \CompanyServer\Reports) with Excel templates and macros.
Steps:
-
Go to File > Options > Trust Center > Trust Center Settings… 2. Click Trusted Locations in the left panel.
-
Click Add new location… 4. Click Browse and navigate to the folder.
-
Check Subfolders of this location are also trusted if you want that.
- Click OK three times.

Security note: Only add folders you genuinely control. Don't add your Downloads folder or Desktop, those are common landing spots for phishing files. *
Method 4: Trust a Specific File (Without Changing Global Settings)
Excel remembers files you've clicked "Enable Content" on as trusted documents. But if you need to clear and re-trust a file or manually add a file to the trusted list, here's how.
To clear all trusted documents (force re-prompting on everything):
-
Go to File > Options > Trust Center > Trust Center Settings… 2. Click Trusted Documents.
- Click Clear All.
- Click OK.
This is useful if you've accidentally trusted a file you shouldn't have, or if you're setting up a clean machine.
Method 5: Unblock a File Downloaded from the Internet (Mark of the Web)
This is the edge case that trips up a lot of people. When you download a file from the internet, your browser and Windows itself adds an invisible "Mark of the Web" (MOTW) flag to it. This flag tells Excel to treat the file as potentially dangerous, even if you've set your macro settings to allow all macros.
In this situation, the yellow bar might say "Protected View" rather than "Macros have been disabled," and clicking Enable Content still leaves macros blocked.
The fix:
- Close the file in Excel.
-
Go to the file in Windows File Explorer (not inside Excel).
- Right-click the file and choose Properties.
-
At the bottom of the General tab, look for a checkbox that says "This file came from another computer and might be blocked to help protect this computer. Unblock." 5. Check the Unblock checkbox.
- Click Apply, then OK.
- Reopen the file in Excel.
If you don't see the Unblock checkbox, the file wasn't flagged by Windows, and this isn't the issue. *
Method 6: Enable Macros for a One-Time Session Using the Ribbon
If you're already inside a file and the yellow bar has disappeared (maybe you dismissed it by mistake), you can still enable macros from the ribbon without going into Trust Center settings.
Steps:
-
Click the File tab.
- You should see a yellow banner under the file name that says "Security Warning: Macros have been disabled." 3. Click Enable Content on that banner.
If you don't see it:
-
Still in File tab, click Info in the left panel.
-
Look for the Security Warning section with an Enable Content button.
- Click Enable Content > Enable All Macros for this session only. *
Method 7: Enable Macros Permanently via the Developer Tab
The Developer tab in Excel gives you direct access to macro controls and provides the following options for macro management and automation, such as the macro recorder, VBA editor, inserting controls, managing add-ins, and importing/exporting XML files. If you do anything with macros regularly, it’s worth enabling this tab.
Step 1: Show the Developer Tab (if hidden)
-
Right-click anywhere on the ribbon and select Customize the Ribbon to enable the Developer tab.
-
In the right column, find Developer and check its checkbox.
- Click OK.
Step 2: Use Macro Security from the Developer Tab
-
Click the Developer tab.
-
Click Macro Security in the Code group.
- Adjust settings as described in Method 2.
Method 8: Enable Macros from the VBA Editor
If you’re troubleshooting a macro that isn’t running, you can open the VBA editor directly and check whether there are compile errors or trust issues at the project level.
Steps:
-
Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
- In the left panel, you’ll see the VBA Project tree. If modules or code are grayed out or show an error, the project may be locked.
-
Go to Tools > Macro Security in the VBA editor menu.
- Here, you can change macro settings to enable or disable macros, similar to the options available in the Trust Center.
This method doesn’t bypass Trust Center settings, it’s more useful for diagnosing why a macro isn’t running when you think it should be.
Automated Tasks with Macros: What Can You Do?
Enabling macros in Excel unlocks a powerful way to automate repetitive tasks and streamline your workflow. With just a few clicks, you can set up Excel to handle everything from data entry and formatting to complex calculations and report generation, saving you hours of manual work and reducing the risk of errors.
To get started with automated tasks, you’ll first need to enable macros in Excel. This is managed through the Trust Center settings, where you can select macro settings that fit your security needs. The Trust Center dialog box allows you to enable VBA macros, disable VBA macros, or allow only digitally signed macros, giving you control over which types of macros can run in your Excel files.
Once macros are enabled, you can automate a wide range of tasks. For example, you might create a macro to automatically format a monthly report, import data from another spreadsheet, or even send summary emails to your team. These automated tasks can be triggered with a single click, making it easy to handle repetitive processes efficiently.
To further streamline your workflow, consider setting up trusted locations in the Trust Center. By adding a network drive or specific folder as a trusted location, macros in Excel files stored there will be enabled automatically, no need to click “Enable Content” every time. This is especially useful for teams sharing macro-enabled workbooks from a central folder.
For users who want to create or customize their own automated solutions, the Developer tab in Excel provides direct access to tools for writing and managing VBA code. From here, you can record new macros, edit existing ones, and adjust macro security settings to suit your needs. Enabling the Developer tab is simple, just go to the File tab, select Options, and check the Developer option in the Customize Ribbon dialog box.
While macros can greatly enhance productivity, it’s important to be mindful of security risks. Only enable macros from trusted sources, and consider using digitally signed macros for added protection. Avoid enabling macros in files from unknown or untrusted locations, as they may contain potentially dangerous code.
By leveraging macros in Excel, you can automate repetitive tasks, ensure consistency, and free up time for more strategic work. Whether you’re formatting reports, importing data, or building custom workflows, enabling macros and using the right Trust Center settings will help you get the most out of your Excel experience. For more detailed instructions and support, refer to the resources provided throughout this guide.
Common Issues and Troubleshooting
"Enable Content" button doesn't appear at all
Most likely cause: Your IT department has enforced a Group Policy that blocks all macros without notification. The setting "Disable all macros without notification" is typically pushed by corporate IT.
What to do: Contact your IT helpdesk. You'll need them to either create an exception for the specific file or folder, or whitelist macros from a trusted publisher.
Macros were enabled, but the file still doesn't work
Check these:
- The macro might reference a file path that no longer exists (e.g., C:\OldServer\data.csv).
- The macro might require a specific Excel add-in that isn't installed.
- Open the VBA editor (Alt + F11) and look for red error indicators on the code.
Yellow bar appears every time the file is opened
Most likely cause: The file is being opened from a network drive or synced folder (OneDrive, SharePoint, Teams) where Excel doesn't remember trusted documents the same way it does for local paths.
Fix: Add the network folder to Trusted Locations (see Method 3), or save a local copy, enable macros, and work from that copy.
Macros are enabled but run slowly or seem to hang
This isn't a trust/permission issue, it's a performance issue. Large macros that loop through thousands of rows, or macros that interact with external data sources, can run slowly. Consider adding Application.ScreenUpdating = False at the start of the macro and Application.ScreenUpdating = True at the end to speed things up.
The file is from a trusted colleague — do we still need to enable macros?
Yes, even if the file came from someone you trust. Excel doesn't know who sent it, it only knows the file location and whether it's been verified. The safe habit is to review what a macro does before enabling it, especially if the file arrived via email.
"Macros in this project are disabled" error message
This usually appears when the VBA project itself is password-protected or when there's a digital signature mismatch. If you own the file, open the VBA editor, go to Tools > VBA Project Properties > Protection tab, and check whether a password has been applied. *
A Note on Excel Versions
The steps above apply to Excel for Microsoft 365, Excel 2019, Excel 2021, and Excel 2016. The Trust Center layout and exact button labels are nearly identical across all these versions.
Excel for Mac: The Trust Center path is slightly different. Go to Excel > Preferences > Security to find macro settings. The "Enable Content" yellow bar still appears the same way.
Excel Online (browser): Macros are not supported in Excel Online. Files with macros will open in read-only mode with a note that macros are disabled. You need the desktop app to run macros.
Excel on mobile (iOS/Android): Macros cannot run on mobile. This is a platform limitation, not a settings issue. *
For Developers: Working with Excel Macros Programmatically Using IronXL
If you’re a developer building an application that generates, reads, or processes Excel files rather than enabling macros manually through the UI, IronXL offers a programmatic approach to working with Excel in C# and .NET without requiring Excel to be installed.
To run macros, the file must be saved as an Excel Macro-Enabled Workbook (.XLSM or .XLSB) format. IronXL can read .XLSM files (macro-enabled workbooks), extract data, and write results back to Excel format. While running VBA macros programmatically requires Excel’s COM interop layer, IronXL is often the right choice when your goal is to process data in Excel files at scale, reading values, writing reports, or exporting to PDF without manual intervention.
Here’s a simple example that reads data from a macro-enabled Excel workbook and writes a processed result:
using IronXL;
// Load a macro-enabled excel workbook
WorkBook workBook = WorkBook.Load("monthly-report.xlsm");
WorkSheet sheet = workBook.WorkSheets.First();
// Read values from the sheet
foreach (var row in sheet["A1:D100"])
{
Console.WriteLine(row.StringValue);
}
// Write processed output to a new Excel file
WorkBook output = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet resultSheet = output.CreateWorkSheet("Processed");
resultSheet["A1"].Value = "Processing complete";
output.SaveAs("output.xlsx");
using IronXL;
// Load a macro-enabled excel workbook
WorkBook workBook = WorkBook.Load("monthly-report.xlsm");
WorkSheet sheet = workBook.WorkSheets.First();
// Read values from the sheet
foreach (var row in sheet["A1:D100"])
{
Console.WriteLine(row.StringValue);
}
// Write processed output to a new Excel file
WorkBook output = WorkBook.Create(ExcelFileFormat.XLSX);
WorkSheet resultSheet = output.CreateWorkSheet("Processed");
resultSheet["A1"].Value = "Processing complete";
output.SaveAs("output.xlsx");
Imports IronXL
' Load a macro-enabled excel workbook
Dim workBook As WorkBook = WorkBook.Load("monthly-report.xlsm")
Dim sheet As WorkSheet = workBook.WorkSheets.First()
' Read values from the sheet
For Each row In sheet("A1:D100")
Console.WriteLine(row.StringValue)
Next
' Write processed output to a new Excel file
Dim output As WorkBook = WorkBook.Create(ExcelFileFormat.XLSX)
Dim resultSheet As WorkSheet = output.CreateWorkSheet("Processed")
resultSheet("A1").Value = "Processing complete"
output.SaveAs("output.xlsx")
IronXL handles formatting, formulas, cell ranges, and multi-sheet workbooks without needing Excel installed on the server making it well-suited for automated reporting pipelines, web applications, and backend data processing.
Summary: Which Method Should You Use?
| Your Situation | Best Method | | --- | --- | | Yellow bar appeared when I opened a file | Method 1: Click Enable Content | | I open macro files every day and want no prompts | Method 2: Trust Center → Enable all macros | | My team shares files from one network folder | Method 3: Add a Trusted Location | | Downloaded file still blocks macros | Method 5: Unblock via Windows Properties | | IT manages my settings and I can't change them | Contact IT helpdesk | | Building a .NET app that processes Excel files | IronXL (see Developer section) |
Enabling macros in Excel is usually a one-click fix. The yellow "Enable Content" bar is Microsoft's way of asking for your permission before running code, click it for files you trust, and leave it blocked for files from unknown sources. For anything more persistent, the Trust Center gives you full control over how Excel handles macro-enabled files across your entire system.




