sodcalculator

10 Tech How-To

How to Unblock Macros in Excel: Step-by-Step

Guide 10-42647 · Updated · Step by step

Macros in Excel are blocked by default for security reasons, but legitimate ones can be unblocked safely. This guide walks you through the four main ways to unblock macros: changing Trust Center settings, unblocking a single file, using a trusted folder, or signing the macro. You’ll need access to Excel’s options and, for some methods, a folder you control.

What You’ll Need

  • Microsoft Excel (2016, 2019, 2021, or Microsoft 365)
  • A macro-enabled file (.xlsm, .xlsb, or .xlam) or the VBA code you want to run
  • Administrator rights on your computer to change Trust Center settings
  • Optional: A folder on your computer for trusted locations

Step-by-Step

  1. Identify the macro block type. When you open a file with macros, look for a yellow bar under the ribbon saying “Macros have been disabled.” If you see that, click “Enable Content” to unblock macros for that file only. If the file is from the internet, you’ll see a Security Warning in the Message Bar; click “Enable Content” and then “Enable All Content” if prompted.
  2. Unblock a single file from its properties. Right-click the file in File Explorer, select “Properties,” and at the bottom of the General tab, check the box “Unblock.” Click Apply and OK. This works for files downloaded from the internet or email. After unblocking, open the file in Excel; macros should run without prompts.
  3. Change Trust Center settings to enable all macros. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings. Select “Enable all macros” (not recommended for everyday use) and check “Trust access to the VBA project object model” if you need to automate VBA. Click OK twice. This unblocks macros globally, but it’s a security risk, so only use it temporarily.
  4. Add a trusted folder for macro files. In Trust Center Settings, go to “Trusted Locations.” Click “Add new location,” browse to the folder where you keep macro files, check “Subfolders of this location are also trusted,” and click OK. Any file in that folder will have macros enabled automatically. This is the safest way to unblock macros you trust.
  5. Digitally sign the macro. If you have a digital certificate (self-signed or from a CA), open the VBA editor (Alt+F11), go to Tools > Digital Signature, and sign the project. Then in Trust Center Settings, under Macro Settings, select “Disable all macros except digitally signed macros.” Excel will trust signed macros from the certificate’s issuer.
  6. Use the Developer tab to run macros manually. If macros are blocked but you need to run one just once, go to the Developer tab (enable it via File > Options > Customize Ribbon if hidden), click “Macros,” select the macro, and click “Run.” This bypasses the block for that instance, but you’ll still see the security warning.

Common Mistakes

  • Enabling all macros permanently. This is a security risk and can allow malicious code to run. Use it only for testing, then revert to a safer setting.
  • Forgetting to unblock the file after moving it. The “Unblock” checkbox resets if you move or copy the file, so re-check it.
  • Not enabling the Developer tab. Many users can’t find the macro options because the Developer tab is hidden by default. Enable it in Excel Options.
  • Trusting a folder that isn’t secure. If you add a folder like Desktop or Downloads, any file there (even malicious ones) will run macros. Use a dedicated folder.

Tips

  • For files you create yourself, they are never blocked, so you don’t need to unblock them.
  • If you receive a macro file from a colleague, ask them to sign it with a digital certificate to avoid the warning.
  • Keep macros in a trusted folder to avoid the yellow bar every time.
  • Use the “Protected View” settings to see if Excel is blocking macros because of Protected View; you can exit Protected View by clicking “Enable Editing” first.

Troubleshooting

  • Macros are still disabled after enabling all macros. Check if the file is in Protected View (click “Enable Editing” first). Also, ensure the file extension is .xlsm, not .xlsx (which cannot contain macros).
  • The “Unblock” checkbox is missing. This can happen if the file is on a network drive or in a cloud-synced folder. Copy the file to your local drive, unblock it, then move it back.
  • Trusted location is not working. Make sure the folder path is correct and that you clicked “OK” to add it. Also, check that the file is not in a subfolder if you didn’t check the subfolders option.
  • VBA project is locked. If you see “Project is locked” when opening the VBA editor, the file may have a password or be protected. You need the password to unprotect it.
  • Macros work on one computer but not another. Trust Center settings are per-machine. Repeat the unblocking steps on the other computer.

Frequently Asked Questions

Why does Excel block macros?

Excel blocks macros by default because they can contain code that might harm your computer. It’s a security measure to prevent malicious files from running automatically.

Is it safe to enable macros?

It’s safe only if you trust the source of the file. If you created the macro or received it from a reliable colleague, enabling it is generally fine. For files from unknown sources, avoid enabling macros.

How do I know if a file has macros?

Check the file extension: .xlsm, .xlsb, or .xlam indicate macros. You can also look for the yellow security bar when opening the file.

Can I unblock macros without changing settings?

Yes, you can click “Enable Content” on the security warning bar for that session. This unblocks macros for that file only, without changing global settings.

What is a digital signature for macros?

It’s a certificate that verifies the macro’s author and ensures the code hasn’t been altered. Excel can be set to trust macros from specific signers.

Why is the “Enable Content” button grayed out?

This usually happens if the file is in Protected View. Click “Enable Editing” first, then the “Enable Content” button will become active.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →