If an Excel macro is not running, first check that you opened the workbook in desktop Excel, that it is saved in a macro-enabled format, and that Excel has not blocked its macros. Then verify the macro is available to run and that its button or event trigger is connected correctly; the right fix depends on which of those steps is failing.
Start with the workbook and Excel version
Excel macros written in VBA run in the desktop versions of Excel for Windows and Mac, but not in Excel for the web. A workbook can open in a browser and display its data without the browser running its VBA macros. If you are using Excel in a browser, select the option to open the file in the desktop app, if available, or download it and open it in desktop Excel.
Next, check the file extension. A workbook saved as .xlsx cannot store VBA macro code. Macro-enabled workbooks commonly use .xlsm, while macro-enabled binary workbooks use .xlsb; the older .xls format can also contain macros. If you saved a macro-enabled file as .xlsx, Excel normally warns that the VBA project will be removed. The original macro may still be in an earlier copy, but changing the extension of the new file does not restore it.
- In File Explorer on Windows or Finder on Mac, confirm the extension is one that supports macros.
- In Excel, use File > Save As and choose Excel Macro-Enabled Workbook (
.xlsm) if the workbook needs to retain VBA. - If a warning appeared during saving, read it carefully. Choose the option that preserves macros when you intend to keep them.
Changing an extension by renaming the file is not a conversion. If the macros were already discarded, retrieve a version that still contains the VBA project, such as an original file or a suitable backup.
Check whether Excel has blocked the macros
Excel restricts macros because VBA can make changes to files, data, and system settings. When you open a workbook, look for a security message beneath the ribbon. If you recognize the source and have a good reason to trust the file, you may be able to select Enable Content. Do not enable macros merely because a document asks you to; an unexpected workbook can contain harmful code.
Files downloaded from the internet or received as attachments may be blocked even when the workbook itself opens. On Windows, close Excel, right-click the file in File Explorer, choose Properties, and look on the General tab for an Unblock checkbox or button. Use it only when you have independently verified that the file is trustworthy, then reopen the workbook. This option may be absent, and workplace policies can prevent users from changing it.
You can inspect Excel’s macro policy on Windows at File > Options > Trust Center > Trust Center Settings > Macro Settings. The exact options available can depend on your organization’s policy. A setting that disables VBA without a notification may explain why no prompt appeared, but do not switch to enabling all macros to make a file work. If a trusted workbook is still blocked, ask your IT administrator about the approved method for reviewing or allowing it.
Trust Center settings on Mac are in Excel > Settings (or Preferences, depending on the version) > Security. Mac and Windows versions do not have identical controls, and organization-managed settings can override what appears in the interface. A trusted location can reduce repeated prompts, but add a folder only if its contents are controlled; any macro-enabled workbook placed there may receive more trust.
Confirm the macro exists and is available
If Excel opens the file but the macro does not appear in the list, make sure you are looking at the correct workbook and macro scope. In desktop Excel, choose Developer > Macros, or use Alt+F8 on Windows. If the Developer tab is hidden, show it through File > Options > Customize Ribbon and select Developer. On Mac, enable the tab under Excel > Settings (or Preferences) > Ribbon & Toolbar; keyboard shortcuts can differ by keyboard layout and version.
- In the Macros dialog, check the Macros in list. Selecting All Open Workbooks can help locate a macro stored in another open workbook.
- A regular macro intended to appear in the dialog generally needs to be a public procedure with no required arguments, stored in a standard VBA module.
- Code in a worksheet module or in ThisWorkbook is often an event procedure, not a macro intended to run from the dialog.
- If the workbook was created by someone else, confirm that the VBA project was actually included and that you opened the correct copy.
One common misunderstanding is that every procedure visible in the Visual Basic Editor should appear under Developer > Macros. Procedures with parameters, private procedures, and event handlers have different purposes and may not be listed as manually runnable macros. If you expect a macro to appear but it does not, ask the workbook’s author where it is stored and how it is supposed to be started.
Check the button, shortcut, or event that starts it
A macro can be present and still seem unresponsive because its launch control is disconnected. For a worksheet button or shape, right-click it and choose Assign Macro, then check that the intended macro is selected. If the right-click menu shows control-specific options instead, you may be dealing with an ActiveX control. On Windows, check whether Developer > Design Mode is selected; while Design Mode is on, clicking an ActiveX control does not run its action. ActiveX controls are not supported in Excel for Mac in the same way as on Windows, so a workbook that depends on them may need a different control or a Windows environment.
For a keyboard shortcut, open Developer > Macros, select the macro, and choose Options to inspect or set its shortcut. A shortcut may conflict with a built-in Excel shortcut, and workbook-specific shortcuts are available only while the relevant workbook is open. If the shortcut does nothing, try running the macro from the Macros dialog to separate a shortcut problem from a macro problem.
Macros that run when a workbook opens or a cell changes are event-driven. A startup macro is usually connected to a workbook-open event; a worksheet-change macro responds to edits in the relevant sheet. These procedures will not behave like a button macro in the Macros dialog. They can also fail if events have been turned off by code that stopped unexpectedly. Because fixing event settings may require inspecting or changing VBA, ask the workbook’s author or a qualified support person if you are not comfortable with the code.
Look for errors, pauses, and missing dependencies
If Excel displays an error, record its exact wording and note whether it appears immediately or after the macro starts. A compile error usually points to a problem in the VBA project, such as invalid code or an unavailable reference. A run-time error means execution began but failed at a particular operation. In the Visual Basic Editor, the highlighted line can help the workbook’s maintainer identify the cause; do not edit unfamiliar code just to dismiss the error.
A macro may also be paused in the VBA editor. If Excel has opened the Visual Basic Editor and highlighted a line, the code may be in break mode rather than running normally. The Reset control in the editor ends the paused run, but resetting does not repair the underlying issue. A missing reference can arise when a workbook depends on an add-in, library, database connection, or file path that is unavailable on the current computer.
- Check whether the macro expects a particular worksheet name, named range, input cell, or open file.
- Confirm required add-ins are installed and enabled, if the workbook author specifies them.
- Check that referenced files are still at the expected location and that you have permission to access them.
- Keep a copy of the exact error message and the steps that produced it before asking for support.
Also consider whether the workbook is in a protected or restricted state. A macro that edits cells may fail if the sheet is protected, if the workbook is read-only, or if required data has not been entered. The error message and the macro’s intended design determine whether protection is expected or a problem.
Distinguish a security problem from a code problem
A useful diagnostic is to run the macro from Developer > Macros rather than from its usual button. If it runs from the dialog, the VBA itself may be available and the button, shortcut, or event trigger is the likely issue. If it does not appear in the dialog, investigate the file format, macro scope, and whether the VBA project exists. If it appears but produces an error, the cause is more likely to be the code, an input, or a dependency.
That test is not conclusive: a macro may depend on being started by a specific event or may have been designed to work only with a particular workbook state. Still, it helps narrow the investigation without changing security settings. Avoid repeatedly clicking controls or enabling broader permissions when you do not know what the code does.
Use safe steps before changing settings
VBA macros can modify workbook contents, overwrite files, send data, or perform other actions allowed to the user. Before running a macro that changes data, make a separate copy of the workbook. Excel’s Ctrl+Z undo command does not reverse changes made by a VBA macro, so a backup is the practical way to preserve the original.
- Confirm who supplied the workbook and whether you expected it.
- Ask what the macro is meant to do, especially if the file came from outside your organization.
- Scan or review the file using your organization’s approved security process.
- Prefer a narrow, approved trust decision over enabling all macros globally.
- If the workbook contains sensitive information, follow your organization’s rules before uploading it to an online scanning service.
For a work computer, do not try to bypass a policy set by an administrator. IT may have disabled macros for a valid security reason and can advise whether the file should be allowed, replaced, or handled another way. The safest solution can be to obtain a clean copy from the sender or use a non-macro version of the process.
Frequently Asked Questions
Why does Excel say macros are disabled?
Excel may be following its Trust Center settings, a policy set by your organization, or a block applied to a file downloaded from the internet. Check for a security notification and verify the file’s source before enabling anything. If the setting is managed, contact your administrator rather than trying to override it.
Can Excel for the web run VBA macros?
No. Excel for the web can open and edit many workbooks that contain VBA, but it does not run VBA macros. Open the workbook in desktop Excel to use its VBA functionality, provided the file and macros are permitted.
Why is my macro missing from the Macros list?
It may be in a different open workbook, saved in a worksheet or ThisWorkbook module as an event procedure, or written with arguments that prevent it from appearing as a manually runnable macro. The file may also be an .xlsx copy without its VBA project. Check the macro scope and file format, or ask the author where the code is stored.
Why does a macro work on one computer but not another?
The computers may have different Excel platforms, security policies, add-ins, references, permissions, or file paths. A Windows-specific control such as an ActiveX control may not work on Mac. Compare the error message and required components with the workbook’s author or support team.
Can I undo a macro with Ctrl+Z?
Usually not. VBA actions do not create Excel’s normal undo history, so Ctrl+Z cannot reliably restore changes made by a macro. Save a separate copy before running code that edits or replaces data.