VBA & Macro Problems

How to Fix Excel Macro Not Found When Clicking a Shape Button

Rana GarciaRana Garcia Nov 3, 2026 869 views

Question details

The user is encountering a 'macro not found' error when attempting to run an Excel macro by clicking an assigned shape or button, even though the macro executes perfectly from the Tools menu.

How to Fix Excel Macro Not Found When Clicking a Shape Button
Product
Microsoft Excel
Device & OS
Mac
Scenario
Assigning and triggering a VBA macro via a shape or print button within a workbook.
Observed behavior
Clicking the assigned shape button produces a 'macro not found' error dialog, while manually running the macro from the standard menu works without issue.
Before you start

Ensure that your workbook is saved as an Excel Macro-Enabled Workbook (.xlsm) and verify that the macro name contains no spaces or unsupported special characters.

Solution 1Recommended

Save the Workbook Under a New Name

Bypass file-level corruption by saving the spreadsheet with a completely new file name and reassigning the macro to the shape.

Often, the connection between a shape object and the VBA module becomes corrupted internally within the file structure. Saving the file as a new document forces Excel to rebuild these internal links.

1
Save As a New File

Open the problematic workbook, click on 'File' in the top menu, and select 'Save As'. Enter a completely new name for the file and ensure the format is set to Excel Macro-Enabled Workbook (.xlsm).

2
Recreate the Shape

Delete the original shape or print button. Go to 'Insert' > 'Shapes' and draw a new shape on your worksheet.

3
Reassign the Macro

Right-click the newly created shape, select 'Assign Macro' from the context menu, choose your macro from the list, and click 'OK'.

4
Test the Button

Deselect the shape and click it again to verify that the macro now runs successfully without triggering the error.

Save the Workbook Under a New Name
Cleanup: Once verified, you can safely delete the original corrupted file and continue your work using the newly renamed version.
Free Microsoft Office alternative

Experience Stable Macro Execution with WPS Office

Struggling with legacy Excel versions and corrupted files? WPS Office is a modern, lightweight, and free alternative that offers comprehensive support for VBA macros and seamless compatibility with Microsoft Excel formats.

  1. 1. Download and Install: Download WPS Office for free from the official website and install it on your device.
  2. 2. Open Your Workbook: Launch WPS Spreadsheet, go to 'Menu' > 'Open', and select your macro-enabled workbook (.xlsm).
  3. 3. Enable Macros and Run: Click 'Enable Macros' in the security warning prompt, then click your shape button to run the macro smoothly.
Fully compatible with Microsoft Excel formats, including .xlsx, .xlsm, and .xls.Advanced VBA macro support for automating repetitive tasks without legacy bugs.Free and lightweight, avoiding the bloat and performance issues of older software.Familiar user interface ensuring zero learning curve for seamless migration.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my macro work from the menu but not from a shape button?

This discrepancy often occurs due to minor workbook corruption or broken internal XML links between the visual shape object and the VBA module. Renaming the file and reassigning the macro forces the application to rebuild these links.

How do I correctly assign a macro to a shape in Excel?

Right-click the target shape or button, select 'Assign Macro' from the context menu, choose the desired macro from the dialog box list, and click OK. Ensure your workbook is subsequently saved as a Macro-Enabled Workbook (.xlsm).

Can a space in the macro name cause the 'macro not found' error?

Yes. Invalid macro names, especially those containing spaces or special characters, can break the assignment link. Ensure your VBA subroutine names only use letters, numbers, and underscores (e.g., 'Run_Report' instead of 'Run Report').