If your Excel macros are not running, the fix is usually one of three things: macros are disabled in Trust Center settings, the file is saved with the wrong extension, or the macro itself has an error. This guide walks you through each fix in order, from the quickest check to the deeper ones.

What You'll Need

  • Access to the Excel file that contains the macro (or a test file you create).
  • Knowledge of where the macro is stored (This Workbook vs. a module).
  • If the macro was sent by someone else, you may need their permission to edit it.

Step-by-Step

Step 1: Check if macros are enabled in Trust Center

  1. Open Excel and go to File > Options (or Excel > Preferences on Mac).
  2. Select Trust Center (Windows) or Privacy & Security (Mac).
  3. Click Trust Center Settings (Windows) or Macro Settings (Mac).
  4. Under Macro Settings, choose Enable all macros (not recommended for files from unknown sources) or Disable VBA macros with notification – the latter will prompt you to enable macros when you open a file.
  5. Click OK and restart Excel.

Note: Menu labels can differ slightly by Excel version and operating system. If you don't see these exact words, look for “Macro Settings” or “VBA” in the Trust Center.

Step 2: Verify the file is saved as a macro-enabled workbook

  1. Check the file extension. It must be .xlsm (macro-enabled) or .xlsb (binary, also supports macros). A regular .xlsx file cannot contain macros.
  2. If the file is .xlsx, open it, press Alt+F11 to open the VBA editor, and see if any modules exist. If not, you need to get the macro-enabled version.
  3. To save as macro-enabled: go to File > Save As, choose Excel Macro-Enabled Workbook (*.xlsm) from the file type dropdown, and save.

Step 3: Check if the macro is disabled by the “Block macros” setting

  1. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings.
  2. Look for Block macros from Office files that are from the Internet – if this is checked, uncheck it (or right-click the file, select Properties, and check Unblock if the file came from the internet).

Step 4: Test the macro with a simple message box

  1. Press Alt+F11 to open the VBA editor.
  2. In the left pane, double-click ThisWorkbook or a module.
  3. Type a simple test: Sub TestMacro() then press Enter, type MsgBox "Hello", then press Enter and type End Sub.
  4. Press F5 while the cursor is inside the macro. If a message box appears, the macro environment works.

Step 5: Run the macro from the correct place

  1. Go to the View tab and click Macros (or press Alt+F8).
  2. In the dialog, select the macro you want and click Run.
  3. If the macro is attached to a button, make sure the button is assigned correctly: right-click the button, choose Assign Macro, and select the macro.

Step 6: Check for errors in the VBA code

  1. Press Alt+F11 to open the VBA editor.
  2. Click Debug > Compile VBA Project. If there's a syntax error, it will highlight the line.
  3. Fix any errors (common ones: missing End If, wrong variable names, or referencing a sheet that doesn't exist).

Step 7: Ensure the macro is not disabled by a digital signature policy

  1. If your organization requires digitally signed macros, unsigned macros may be blocked. Check with your IT department.
  2. In Trust Center, under Macro Settings, see if Require application add-ins to be signed by Trusted Publisher is checked – if so, you need to add the publisher or uncheck it (if allowed).

Common Mistakes

  • Saving as .xlsx instead of .xlsm – this strips macros.
  • Forgetting to enable macros when the yellow bar appears – click Enable Content.
  • Running a macro that references a sheet name that doesn't exist (e.g., typing “Sheet1” when the sheet is named “Data”).
  • Using Private Sub when you want to run from the Macros dialog – private subs don't appear in the list.
  • Not checking the macro's location – if it's in a personal workbook, it won't run in other files unless the personal workbook is open.

Tips

  • Always save a backup copy of your file before editing macros.
  • Use Option Explicit at the top of modules to catch undeclared variables.
  • Break long macros into smaller subroutines to make debugging easier.
  • Use Debug.Print to output values to the Immediate Window (Ctrl+G in VBA editor) to see what's happening.
  • If a macro works on one computer but not another, compare the Trust Center settings and the Excel version.

Troubleshooting

If the macro still doesn't run:

  1. Restart Excel – sometimes a fresh session clears temporary glitches.
  2. Check if the macro is in a different workbook – open the VBA editor and look in the Project Explorer (Ctrl+R) to see which file the module is under.
  3. Look for “#Name?” errors – this indicates the macro name is misspelled or the function is not recognized.
  4. Try a different file – create a new workbook, copy the macro code into a module, and test. If it works, the original file may be corrupted.
  5. Check if the macro is disabled by a security update – some Excel updates temporarily block macros. Check for updates and install them.
  6. If the macro used to work and now doesn't, check if you changed the sheet name or structure – macros often reference specific cells or sheets.

Frequently Asked Questions

Why are my macros greyed out?

Macros are greyed out when the workbook is not macro-enabled (.xlsx) or when the VBA project is protected. Save as .xlsm, or unprotect the VBA project (if you know the password).

How do I enable macros permanently?

Go to Trust Center > Macro Settings and select Enable all macros (not recommended for untrusted files). Better: use Disable VBA macros with notification and click Enable Content when opening.

Can macros run on Excel for Mac?

Yes, but the Trust Center settings are under Excel > Preferences > Security & Privacy. Also, some Windows-only APIs may not work on Mac.

What does “Macros are disabled” error mean?

It means the file's macros are blocked by Trust Center settings or the file is marked as from the internet. Unblock the file (right-click > Properties > Unblock) or adjust Trust Center settings.

Why does my macro run but do nothing?

Check if the macro references a specific sheet or range that doesn't exist. Also, if the macro uses ScreenUpdating = False, it may be running but not showing changes – add a message box to test.

How do I see a list of all macros?

Press Alt+F8 to open the Macro dialog. It lists all available macros in open workbooks. If your macro isn't listed, it might be private or in a different workbook.