Fix Excel Cannot Run Macro Error on a Chart
Question details
The user encounters a 'Cannot run the macro' error when interacting with a chart because the previously assigned macro has been deleted or is missing.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Clicking or interacting with an Excel chart that previously had a macro assigned to it.
- Observed behavior
- Excel displays a warning that the macro cannot be run, may not be available in the workbook, or all macros are disabled, even though the macro was intentionally removed.
Ensure your worksheet is not protected, as worksheet protection can prevent you from selecting, right-clicking, or modifying chart properties.
Remove the Obsolete Macro Assignment from the Chart
Directly remove the macro name linked to the chart so Excel stops attempting to execute the deleted script.
When a macro is deleted from the VBA editor, any objects or charts that were assigned to run that macro will not automatically update. You must manually clear the assignment from the chart.
Locate the chart triggering the error in your worksheet and right-click on its outer edge.
Select 'Assign Macro...' from the context menu that appears.
In the Assign Macro dialog box, highlight the obsolete macro name in the 'Macro name' text field.
Press the Delete or Backspace key to clear the text field, then click 'OK' to save your changes.

Manage Excel Macros and Charts Seamlessly in WPS Spreadsheet
WPS Office Spreadsheet provides excellent compatibility with Excel macros, VBA, and chart controls. You can easily assign, edit, or remove macros from objects using a familiar interface without encountering unnecessary errors.
- 1. Open your file in WPS: Launch WPS Spreadsheet and open your .xlsm or .xlsx workbook.
- 2. Right-click the chart: Find the chart that is causing the macro error and right-click it.
- 3. Select Assign Macro: Click 'Assign Macro' from the drop-down menu.
- 4. Clear the assignment: Delete the invalid macro name from the input field and click 'OK'.

Frequently Asked Questions
Why does Excel say macros are disabled when I click a chart?
This usually happens if the chart is linked to a macro that has been deleted or renamed. It can also occur if your Excel Trust Center settings are configured to disable all macros without notification.
How do I select a chart if right-clicking does nothing?
Go to the 'Page Layout' or 'Format' tab on the ribbon and open the 'Selection Pane'. Click the chart's name in the list on the right side of the screen to select it, which allows you to modify its properties.
Does unprotecting the sheet help with unclickable charts?
Yes. If a worksheet is protected and the 'Edit objects' permission is restricted, you won't be able to click or right-click charts. Navigate to the 'Review' tab and click 'Unprotect Sheet' to regain access.




