VBA & Macro Problems

Fix Excel Cannot Run Macro Error on a Chart

Muhammad TalhaMuhammad Talha Nov 3, 2026 868 views

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.

How to Fix Excel Cannot Run Macro Error on a Chart
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.
Before you start

Ensure your worksheet is not protected, as worksheet protection can prevent you from selecting, right-clicking, or modifying chart properties.

Solution 1Recommended

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.

1
Right-click the chart

Locate the chart triggering the error in your worksheet and right-click on its outer edge.

2
Open Assign Macro settings

Select 'Assign Macro...' from the context menu that appears.

3
Delete the macro name

In the Assign Macro dialog box, highlight the obsolete macro name in the 'Macro name' text field.

4
Apply changes

Press the Delete or Backspace key to clear the text field, then click 'OK' to save your changes.

Remove the Obsolete Macro Assignment from the Chart
Chart not clickable?: If right-clicking the chart does nothing, navigate to the Page Layout tab and open the Selection Pane to select the chart. Alternatively, go to the Review tab and click 'Unprotect Sheet' to ensure object editing is allowed.
Manage Macros Easily with WPS Office

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. 1. Open your file in WPS: Launch WPS Spreadsheet and open your .xlsm or .xlsx workbook.
  2. 2. Right-click the chart: Find the chart that is causing the macro error and right-click it.
  3. 3. Select Assign Macro: Click 'Assign Macro' from the drop-down menu.
  4. 4. Clear the assignment: Delete the invalid macro name from the input field and click 'OK'.
Full compatibility with Microsoft Excel (.xlsx, .xls, .xlsm) formats.Built-in VBA editor for running, editing, and debugging macros.Intuitive chart and shape management tools.Free and lightweight alternative to Microsoft Office.
microsoft office alternative - wps office

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.