VBA & Macro Problems

Fix “The Macro Cannot Be Run” in an Excel Workbook

Chanuka GeekiyanageChanuka Geekiyanage Dec 2, 2026 869 views

Question details

The user needs to run a macro in an Excel workbook without receiving a macro availability or security error.

Fix “The Macro Cannot Be Run” in an Excel Workbook
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.
Before you start

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.

Solution 1Recommended

Save the workbook in a macro-enabled format

Use this solution if the workbook is saved in a format that cannot retain VBA macros.

1
Check the file format

In Excel, select File > Save As and inspect the file type.

2
Choose a macro-enabled type

Choose Excel Macro-Enabled Workbook (*.xlsm) or Excel Binary Workbook (*.xlsb), then select Save.

3
Reopen the workbook

Close and reopen the saved file, then try the macro again.

Save the workbook in a macro-enabled format
Missing VBA code: Saving an .xlsx file as .xlsm does not restore macros that were previously removed. If the code is missing, open a macro-enabled copy that still contains it.
Free Microsoft Office alternative

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.

Open and edit Excel .xlsx and .xls spreadsheet filesWork with spreadsheet data in a familiar interfaceUse a free, lightweight suite for everyday office tasksMove common Office documents between applications
microsoft office alternative - wps office

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.