How to Activate Macros in Excel (Step-by-Step)

VBA & macros · Updated November 22, 2026

Activating macros in Excel lets you run automated tasks written in VBA (Visual Basic for Applications), such as repetitive formatting, data cleaning, or custom calculations. By default, Excel disables macros for security reasons. This guide shows you how to enable them safely for a single workbook, for all workbooks, and via the Trust Center, plus how to handle common issues. You’ll need a workbook containing a macro (usually a .xlsm or .xlsb file) and permission to change Excel settings on your computer.

What You’ll Need

  • A Windows PC with Microsoft Excel (Microsoft 365 or Excel 2021/2019). Steps differ slightly on Mac.
  • A macro-enabled workbook (.xlsm) or a file with macros you want to run.
  • Administrator rights on your computer if you need to change Trust Center settings.

Step-by-Step

Method 1: Enable Macros for One Workbook (Quickest)

  1. Open Excel and go to File > Open and select your macro-enabled workbook. When the file opens, a yellow or red security bar appears just below the ribbon (the top menu).
  2. Click the Enable Content button on that bar. If a dialog box appears asking about enabling macros, click Enable Macros.
  3. Excel will now run the macros in that workbook. This setting applies only to this file; other workbooks remain protected.

Method 2: Enable All Macros (Not Recommended for Untrusted Files)

  1. Go to File > Options (at the bottom of the left menu).
  2. In the Excel Options dialog, select Trust Center on the left, then click Trust Center Settings.
  3. In the Trust Center dialog, choose Macro Settings on the left.
  4. Select Enable all macros (not recommended; potentially dangerous code can run). Click OK twice to close both dialogs.
  5. Restart Excel for the change to take full effect. Now all workbooks will run macros without asking.

Method 3: Add a Trusted Location (Safer for Your Own Files)

  1. Create a folder on your computer, e.g., C:\MyMacros, and place your macro-enabled workbooks there.
  2. In Excel, go to File > Options > Trust Center > Trust Center Settings.
  3. Select Trusted Locations on the left, then click Add new location.
  4. Click Browse, select the folder you created, and check Subfolders of this location are also trusted if needed. Click OK three times.
  5. Any workbook opened from that folder will have macros enabled automatically, without the security bar.

Method 4: On Mac (Excel for Mac)

  1. Open the workbook. Go to the Tools menu and select Macros, then Security.
  2. Choose Enable all macros or Disable macros with notification (recommended). Click OK.
  3. If you choose notification, a dialog appears when you open a macro file; click Enable Macros.

Common Mistakes

  • Enabling macros without checking the source. Malicious macros can harm your computer. Only enable macros in files from people you trust.
  • Forgetting to save as .xlsm. If you save a workbook with macros as .xlsx, the macros are removed. Use File > Save As and choose “Excel Macro-Enabled Workbook (*.xlsm)”.
  • Clicking “Disable macros” accidentally. If the security bar disappears, reopen the file or check the Trust Center settings.
  • Enabling all macros permanently. This leaves your system open to any macro, even from unknown sources. Use trusted locations instead.

Tips

  • Before running a macro, save a copy of your workbook (Ctrl+S, or Cmd+S on Mac) because macros cannot be undone with Ctrl+Z.
  • To see what a macro does before running it, press Alt+F11 (Windows) or Option+F11 (Mac) to open the VBA editor and review the code.
  • If you frequently use your own macros, set up a trusted folder as described in Method 3—it’s both safe and convenient.
  • Use File > Info > Protect Workbook to mark a file as final, which can also affect macro prompts.

Troubleshooting

  • “Macros are disabled” error when you try to run a macro. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings and select “Disable VBA macros with notification” (the default). Then reopen the file and click Enable Content.
  • Security bar doesn’t appear. The file may already be trusted (e.g., in a trusted location) or macros are fully disabled. Check Trust Center settings and ensure the file is not from an internet location (right-click file > Properties > Unblock if needed).
  • Macro runs but does nothing. The macro might be empty, or the code has an error. Open the VBA editor (Alt+F11) and press F5 to run step-by-step, or check for a message box.
  • “Cannot find macro” error. The macro may be in a different workbook. Make sure the correct workbook is active before running, or reference it as WorkbookName.xlsm!MacroName.
  • Excel crashes when enabling macros. This is rare but can happen with corrupted files. Try opening Excel in Safe Mode (press Ctrl while starting Excel) and then open the file.

Frequently Asked Questions

Are macros safe to enable?

Macros are safe if the file comes from a trusted source. However, macros can contain malicious code. Always verify the sender and consider reviewing the code in the VBA editor before enabling.

Why is the “Enable Content” button missing?

This happens when macros are completely disabled in Trust Center, or the file is already trusted. Check Macro Settings and ensure the file isn’t in a trusted location. Also, if the file is from the internet, right-click it in File Explorer, select Properties, and check “Unblock”.

Can I enable macros for just one session?

Yes. When you click Enable Content, macros are enabled for that session only. Closing and reopening the file will prompt again unless the file is in a trusted location.

What is the difference between .xlsx and .xlsm?

.xlsx files cannot contain macros; .xlsm files can. If you save a macro-enabled workbook as .xlsx, Excel removes the macros with a warning. Always use .xlsm for files with macros.

How do I create a macro?

Go to View > Macros > Record Macro, give it a name, and perform the actions you want to automate. Then stop recording. You can also write VBA code manually in the VBA editor.

Will enabling macros affect other Office programs?

No. Macro settings in Excel apply only to Excel. Word, PowerPoint, and other Office apps have their own Trust Center settings.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.