VBA & Macro Problems

Fix Excel Button Macro Not Working When Clicked

Muhammad TalhaMuhammad Talha Nov 12, 2026 869 views

Question details

The user needs to make an Excel macro run when an on-sheet button is clicked, although the same macro runs from the Alt+F8 Macro dialog.

Product
Microsoft Excel VBA macros
Device & OS
not provided
Scenario
A workbook contains a button intended to launch a macro, and the user is troubleshooting whether the button is a Form Control or an ActiveX control.
Observed behavior
The macro runs from Alt+F8 but does not run when the user clicks the Excel button.
Before you start

Confirm whether the button is a Form Control or an ActiveX control by right-clicking it and checking the available commands. Also verify that the workbook is saved as a macro-enabled file, such as .xlsm, and that macros are enabled.

Solution 1Recommended

Assign the macro to an Excel Form Control button

Use this method when the button is a Form Control and the macro is stored in a standard VBA module.

Form Controls launch a public macro through an assignment dialog. The procedure should be stored in a standard module rather than only in a worksheet or ThisWorkbook module.

1
Open the button menu

In Excel, right-click the button and choose Assign Macro.

2
Select the public macro

Choose the intended public Sub procedure from the Macro name list, then click OK. The procedure should be in a standard module and should not require arguments.

3
Test the button

Click away from the button and click it once. If it still does not run, open the Developer tab and confirm Design Mode is turned off.

Check the macro location: A Form Control button cannot directly use a private procedure or a procedure placed only inside a worksheet event module. Move the callable Sub to a standard module if necessary.
Free Microsoft Office alternative

Move button-based spreadsheet tasks to WPS Office

WPS Office is a free, lightweight Microsoft Office alternative with a familiar interface and strong compatibility for common Excel .xlsx and .xls files. It can help with everyday spreadsheet editing and migration, although Excel-specific VBA button behavior may require Microsoft Excel.

  1. 1. Install WPS Office: Download and install WPS Office, then open WPS Spreadsheet from the main launcher.
  2. 2. Open the Excel workbook: Choose Open from the Home screen and select the .xlsx or .xls workbook you want to review or edit.
  3. 3. Check the workbook content: Review the sheets, formulas, and button layout in WPS Spreadsheet. For Excel-only VBA or ActiveX behavior, test the original macro-enabled workbook in Microsoft Excel.
Free, lightweight spreadsheet software for everyday workbook editingFamiliar ribbon-style interface that supports a seamless migration from ExcelCompatible with Microsoft Excel .xlsx and legacy .xls formatsUseful for reviewing, editing, and sharing spreadsheets when Excel is unavailable
microsoft office alternative - wps office

Frequently Asked Questions

Why does the Excel macro run with Alt+F8 but not from the button?

Alt+F8 runs the selected macro directly, while a button depends on its control type and event configuration. A Form Control must have the macro assigned through Assign Macro, while an ActiveX button must use its worksheet click event.

How can I tell whether an Excel button is a Form Control or ActiveX control?

Right-click the button. A Form Control typically shows Assign Macro, while an ActiveX control provides properties and code-related commands. You can also use Developer > Design Mode to inspect ActiveX controls.

Where should a macro for a Form Control button be stored?

Store the callable public Sub in a standard VBA module, such as Module1. A Form Control generally will not run a private procedure or a procedure placed only in a worksheet module.

Why does my ActiveX button do nothing when I click it?

Design Mode may still be enabled, or the code may not be inside the correct event, such as CommandButton1_Click. Open the button's View Code window, verify the event procedure, disable Design Mode, and test again.

Can WPS Office fix an Excel VBA button macro?

WPS Office is suitable for editing and reviewing compatible .xlsx and .xls files, but Excel-specific VBA and ActiveX button behavior should be tested in Microsoft Excel. Use Excel to assign the macro and validate its event code.