Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Enable Macros in Excel VBA

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To enable macros in Excel VBA, you must adjust Excel’s security settings to allow macro execution — this lets you run automated scripts written in Visual Basic for Applications that streamline tasks like data cleaning, reporting, or formatting. Without enabling macros, Excel blocks them by default for security, even if they’re from trusted sources. You need Excel installed and a workbook containing VBA code — no additional software is required.

What You'll Need

  • Microsoft Excel (2010 or later)
  • A workbook with VBA macros saved as .xlsm, .xlsb, or .xlam
  • Administrative rights on your computer (if corporate policy restricts settings)

Step-by-Step

  1. Open the Excel workbook that contains the macros. If you see a yellow security warning bar at the top of the window saying "Macros have been disabled," proceed to the next step. If no warning appears, the file may not contain macros or they’re already enabled.
  2. Click on the "Enable Content" button in the security warning bar. This temporarily enables macros for this session only. If the bar is not visible, go to Step 3.
  3. Go to the "File" tab in the top-left corner of Excel.
  4. Select "Options" from the bottom of the left-hand menu. This opens the Excel Options window.
  5. In the Excel Options window, click "Trust Center" on the left side, then click the "Trust Center Settings" button on the right.
  6. In the Trust Center window, select "Macro Settings" from the left panel.
  7. Choose one of these options based on your needs:
    • "Disable all macros with notification" — Recommended for most users. Shows a warning bar when macros are present, letting you choose to enable them per file.
    • "Enable all macros" — Only use this if you are certain all files you open are safe. This setting removes warnings and is a security risk.
    • "Disable all macros except digitally signed macros" — Allows only macros with trusted digital signatures — best for enterprise environments.
  8. Click "OK" to close the Trust Center window, then click "OK" again to close Excel Options.
  9. Close and reopen the workbook. You should now see the security warning bar again when opening a macro-enabled file.
  10. Click "Enable Content" on the warning bar to permanently enable macros for this file during this session. If you trust the source, check the box "Trust all documents from this location" if the file is stored in a trusted folder (see Tips).

Common Mistakes

  • Clicking "Enable Content" once and assuming macros stay enabled permanently — they’re only enabled for the current session unless you change Trust Center settings.
  • Choosing "Enable all macros" without understanding the risk — this leaves your system vulnerable to malicious code embedded in files from untrusted sources.
  • Trying to enable macros in a .xlsx file — these files cannot contain macros. You must save the file as .xlsm to preserve VBA code.
  • Ignoring the file location — macros may be blocked if the file is downloaded from the internet or opened from a network drive unless the folder is added to Trusted Locations.
  • Assuming macro settings apply to all Excel files — each file’s macro enablement is controlled individually unless you set a global policy.

Tips

  • Add the folder where you store trusted macro files to Excel’s Trusted Locations: go to Trust Center > Trusted Locations > Add New Location, then browse to the folder. Files opened from here won’t trigger macro warnings.
  • Digitally sign your own macros with a certificate if you distribute them. This allows users to trust your code without disabling all security.
  • Use the Developer tab to view or edit macros — if it’s not visible, enable it via File > Options > Customize Ribbon > check "Developer" under Main Tabs.
  • Always scan macro files with antivirus software before enabling them, even if they come from a known source.
  • When sharing macro-enabled files, remind recipients to enable content and check their Trust Center settings — they may have stricter policies.

Troubleshooting

  • If the "Enable Content" button is grayed out, the file may be blocked by Windows. Right-click the file in File Explorer, select "Properties," and check "Unblock" at the bottom if the option appears. Then reopen the file in Excel.
  • If you’re on a work computer and can’t change Trust Center settings, your organization’s IT policy may restrict macros. Contact your IT department for approval or request a signed version of the file.
  • If Excel crashes or freezes when enabling macros, the VBA code may be corrupted. Open the file in Safe Mode: hold Ctrl while launching Excel, then open the file. If it works, the issue may be with add-ins — disable them one by one via File > Options > Add-ins.
  • If you see "The macro cannot be found" after enabling, the code may have been deleted or renamed. Open the VBA Editor (Alt+F11), check the Project Explorer for your module, and ensure the macro name matches what you’re trying to run.
  • If macros still don’t run after following all steps, save the file as .xlsm again: go to File > Save As, choose "Excel Macro-Enabled Workbook (*.xlsm)" from the file type dropdown, and overwrite the file.

Frequently Asked Questions

Why can’t I see the Enable Content button?

The file might be saved as .xlsx, which doesn’t support macros. Save it as .xlsm. Also, if the file is blocked by Windows (downloaded from the internet), right-click it, go to Properties, and check "Unblock."

Is it safe to enable all macros?

No. Enabling all macros removes all security warnings and makes your system vulnerable to malware disguised as legitimate files. Use "Disable all macros with notification" instead.

Can I enable macros on a Mac?

Yes. In Excel for Mac, go to Excel > Preferences > Security > Macro Settings and choose your option. The steps are similar but the menu path differs slightly.

Why do macros disable themselves after I close Excel?

By default, Excel only enables macros for the current session. To make them persist, change the Trust Center setting to "Disable all macros with notification" and click "Enable Content" each time you open the file. Adding the file’s folder to Trusted Locations removes the need to enable manually.

Do macros work in Excel Online?

No. Excel Online does not support VBA macros. You must use the desktop version of Excel to create, edit, or run macros.

What happens if I open a file with malicious macros?

If macros are enabled and the code is malicious, it could install malware, steal data, or corrupt files. Always verify the source, scan files with antivirus software, and avoid enabling macros from unknown senders.