Macros in Excel are disabled by default, so the quickest fix is to open File > Options > Trust Center > Trust Center Settings > Macro Settings and pick the setting that matches how much you trust your files. Most home and small-office users should choose "Disable all macros with notification" so Excel shows a yellow security bar whenever a workbook contains a macro, and you decide file by file whether to enable it. If you regularly use your own macro workbook, "Disable all macros except digitally signed macros" plus a self-signed certificate, or a dedicated Trusted Location, saves you clicking Enable every time. Menu labels can differ slightly by Excel version, platform and region, so if you see a close variation of a name below, that is expected.

What You'll Need

  • Excel installed on Windows or Mac. On Excel for the web, macros cannot run at all; you need the desktop app for any of this.
  • A macro-enabled workbook saved with the .xlsm extension (or a legacy .xls file). A normal .xlsx file cannot store macros, so nothing below will help it.
  • On Windows, an administrator account or permission to change Trust Center settings in some company-managed setups. On a work laptop, settings are often locked by policy and shown greyed out.
  • Your own macro workbook, ideally stored in a folder you control, if you plan to use Trusted Locations.

Step-by-Step

  1. Confirm the file is macro-enabled. The title bar should end in .xlsm. If you are looking at a .xlsx file that used to hold a macro, the macro is already gone and you need to rebuild it or recover it from a copy. This is the single most common cause of "my macro disappeared".
  2. Open the Macro Settings dialog. On Windows, go to File > Options > Trust Center, then click Trust Center Settings, then Macro Settings in the left pane. On Mac, go to the Excel menu > Preferences > Security (wording varies by version; look for the macro security section).
  3. Read the four options before changing anything. "Disable all macros without notification" blocks everything silently. "Disable all macros with notification" blocks them but shows a security bar you can click to enable. "Disable all macros except digitally signed macros" allows only macros from a certificate you have marked as trusted. "Enable all macros (not recommended)" runs anything without asking. That last one is a real malware risk, because a macro can do almost anything your user account can do, including encrypting your files or downloading programs.
  4. Select "Disable all macros with notification". This is the balanced default for most people: safe by default, and one click when you need a known file to run. Click OK twice to close both dialogs.
  5. Close and reopen the workbook. Macro settings are read when a file is opened, so a change rarely applies to a workbook that is already on screen.
  6. Enable the macro for that session. When the yellow bar appears, click Enable Content. The macro runs until you close the file. If you see a red shield bar instead, that file's macros are blocked by a stricter policy or a file-blocking rule, and you will need the steps in the troubleshooting section.
  7. Skip the prompt for your own trusted files. Open File > Options > Trust Center > Trust Center Settings > Trusted Locations, click Add new location, and point it at a folder you created for your macro workbooks (for example a folder inside your Documents). Files in a Trusted Location run macros without the security bar. Keep this folder small and keep it out of Downloads, where every new file lands.
  8. Consider a Trusted Location for network paths only with care. The Trusted Locations dialog also has a checkbox to allow locations on your network. Leave it off unless you control that share, because anyone who can write to the share can then run code on your machine.
  9. Handle files from the internet deliberately. Files downloaded from email or a browser carry a mark that makes Excel block macros even in a Trusted Location, depending on your settings. If the source is someone you know and the file was expected, right-click the file in File Explorer, open Properties, and tick Unblock, then reopen it. Only do this when you are certain of the sender.
  10. For repeated use, add a digital signature. In the Visual Basic Editor (Alt+F11 on Windows), choose Tools > Digital Signature to attach a self-signed certificate you create with the SelfCert tool bundled with Office on Windows. Then pick "Disable all macros except digitally signed macros". Sign again after every code change, because editing invalidates the signature.
  11. Do not forget the VBA project trust setting. Just below the macro options is a checkbox for trusting access to the VBA project object model. Leave it unticked for normal use. Turning it on allows code to change other code, which is a common path for self-spreading macros.
  12. Test the result. Close Excel fully, reopen your .xlsm file, and check that the macro either runs, prompts, or is blocked exactly as you expect. If you changed a company laptop and the options are greyed out, the setting is managed centrally and only your IT administrator can alter it.

Common Mistakes

Saving a macro-laden workbook as .xlsx and then wondering why the code vanished. Excel warns you when you save that way; read the warning and choose Keep Macro-Enabled Format instead.

Choosing "Enable all macros" to get rid of a prompt. It removes the prompt from every file you will ever open, which is exactly the situation macro-based malware is designed for.

Adding your whole Downloads folder as a Trusted Location. That quietly disables the notification for every attachment you ever save there.

Expecting the setting to apply to an open workbook. It does not; reopen the file.

Assuming Excel for the web, Excel on a phone or tablet, and Excel on a Mac behave identically to Windows. Excel for the web cannot run VBA at all, mobile apps have no Trust Center, and the Mac dialog lives in Preferences with different wording.

Tips

Keep one folder for macro workbooks and nothing else, so a Trusted Location stays a small, controlled area.

Use Alt+F8 on Windows to list available macros, and Alt+F11 to open the editor, when you want to check whether a file really contains code.

Write a one-line comment at the top of each macro explaining what it does and where you got it, so a file you inherit is not a mystery later.

If you share workbooks with macros, tell recipients the file is macro-enabled and where it came from; the security bar is easier to accept when the source is known.

Troubleshooting

The security bar does not appear. Your setting is probably "Disable all macros without notification". Change it back to the notification option, reopen the file, and look again.

The security bar appears but Enable Content is greyed out or clicking it does nothing. The file is in a blocked state rather than a merely untrusted one. Check File > Info for a message about blocked content, check the file's Properties for the Unblock box, and check whether the folder is excluded by policy.

Macros were working and stopped after an update. Office updates can tighten default behaviour and can reset folder-level trust for locations that no longer qualify. Revisit Macro Settings, re-add the Trusted Location if needed, and re-sign your workbook if you use signatures.

The options are greyed out. A group policy is controlling them. Do not try to work around it on a managed machine; ask the administrator.

The macro runs but errors out. That is a code problem, not a macro settings problem. Check the error description, confirm the referenced sheets and ranges still exist, and use Debug > Compile in the editor to catch syntax errors introduced by edits.

Frequently Asked Questions

Are macros dangerous?

They can be. VBA can read and change files, contact the network and run system commands as you. That is why the default is off and why you should only enable files from sources you trust.

Does Excel for the web run macros?

No. It can display a macro-enabled workbook but cannot execute VBA. Open the file in desktop Excel to run it.

What is the difference between .xlsm and .xlsx?

Only .xlsm (and legacy .xls) can store VBA code. .xlsx has no place for it, so saving as .xlsx strips the macros.

Can I enable macros for one file only?

Yes. That is what "Disable all macros with notification" does: the decision is made per file, per session, when you click Enable Content.

Do Trusted Locations override the macro setting?

Workbooks in a Trusted Location are treated as trusted and run without the prompt, so treat that folder as a security boundary.

Is a digital signature better than a Trusted Location?

A signature proves the file came from the certificate holder and has not been modified since signing, which is stronger for sharing. A Trusted Location is simpler for files that stay on your own machine.