Fix “The Macro Cannot Be Run” in an Excel Workbook
Question details
The user needs to run a macro in an Excel workbook without receiving a macro availability or security error.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user runs a VBA macro from a workbook, button, or command.
- Observed behavior
- Excel displays “The Macro Cannot Be Run,” potentially because the macro is disabled, unavailable, saved in an unsuitable format, or incorrectly assigned.
Confirm that you trust the workbook and its source before enabling macros. Check the file extension and identify the button or command that triggers the error.
Save the workbook in a macro-enabled format
Use this solution if the workbook is saved in a format that cannot retain VBA macros.
In Excel, select File > Save As and inspect the file type.
Choose Excel Macro-Enabled Workbook (*.xlsm) or Excel Binary Workbook (*.xlsb), then select Save.
Close and reopen the saved file, then try the macro again.

Check Excel macro security and file blocking
Use these checks when a trusted workbook's macros are blocked or disabled.
Verify the VBA procedure and button assignment
Use this solution if the macro is missing, has a different name, or a button points to the wrong procedure.
Work with spreadsheets in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for opening and editing spreadsheets. Its support for common Office formats makes moving everyday files easier, though it does not fix Excel's macro security or guarantee VBA compatibility.

Frequently Asked Questions
Why does Excel say a macro cannot be run?
The macro may be disabled, missing, or assigned incorrectly. Check File > Options > Trust Center > Trust Center Settings > Macro Settings, then inspect the workbook's VBA code and button assignment.
Can an .xlsx workbook contain a working VBA macro?
An .xlsx file cannot retain VBA macros. Use File > Save As to save a workbook that contains VBA as an .xlsm or .xlsb file. Changing the extension cannot recover code already removed.
How do I reconnect a button to a macro?
For a Form Control button, right-click it, select Assign Macro, choose the correct macro, and click OK. ActiveX buttons may instead use an event handler accessible through Developer > Design Mode > View Code.
Why are macros blocked after I download a workbook?
Windows may mark a downloaded file as coming from the internet. If you trust the file, close Excel, right-click the file in File Explorer, select Properties, and use Unblock if that option is available.




