VBA & Macro Problems

How to Fix an Excel Macro Button That Does Not Launch Solver

Jason MillerJason Miller Oct 26, 2026 869 views

Question details

The user's Excel VBA macro successfully runs Solver from the Visual Basic editor but fails to execute when triggered via a worksheet button.

How to Fix an Excel Macro Button That Does Not Launch Solver
Product
Excel
Device & OS
not provided
Scenario
Attempting to run a macro that automates the Solver add-in by clicking a button located on the spreadsheet.
Observed behavior
The macro executes perfectly within the VBA editor environment, but clicking the worksheet button (often an ActiveX control) fails to launch Solver.
Before you start

Ensure that the Solver add-in is properly enabled in your Excel Options and that you have enabled macros in your Trust Center settings.

Solution 1Recommended

Replace the ActiveX Control with a Form Control Button

ActiveX buttons can sometimes restrict macro execution for add-ins like Solver due to focus and security issues. Replacing it with a standard Form Control button is the most reliable fix.

ActiveX controls interact differently with the Excel application compared to standard Form Controls. When an ActiveX button is clicked, it can retain focus and prevent the Solver add-in dialog or execution process from initializing properly. Swapping it for a Form Control button ensures smooth execution.

1
Delete the ActiveX button

Enable 'Design Mode' on the Developer tab, select the problematic ActiveX button on your worksheet, and press the Delete key.

2
Insert a Form Control button

On the Developer tab, click 'Insert'. Under the 'Form Controls' section (usually the top section), select the 'Button (Form Control)' icon.

3
Draw the button and assign the macro

Click and drag on the worksheet to draw the new button. The 'Assign Macro' dialog box will immediately pop up. Select your Solver macro procedure from the list and click 'OK'.

4
Test the new button

Click anywhere on a blank cell to deselect the button, then click the new button to verify that it successfully launches Solver.

Replace the ActiveX Control with a Form Control Button
Verify VBA Reference: In the Visual Basic Editor, go to Tools > References, and ensure the box next to 'Solver' is checked so your macro can communicate with the add-in.
Free Microsoft Office alternative

Looking for a Smoother Spreadsheet Experience? Try WPS Office

If you are tired of dealing with ActiveX control glitches and complex macro troubleshooting in Microsoft Excel, consider switching to WPS Office. It provides a highly compatible, lightweight, and free alternative with excellent spreadsheet capabilities.

  1. 1. Download WPS Office: Visit the official WPS Office website and download the installer for your operating system.
  2. 2. Install and Launch: Run the installation file, follow the prompts, and open WPS Spreadsheets.
  3. 3. Open Your Spreadsheets: Load your existing spreadsheets seamlessly and enjoy a stable, user-friendly data analysis environment.
Completely free and lightweight office suiteHigh compatibility with Microsoft Excel formats, including .xlsm and .xlsx filesFamiliar user interface requiring zero learning curveRobust data analysis tools and streamlined functionality
microsoft office alternative - wps office

Frequently Asked Questions

Why does my macro work perfectly in the VBA editor but fail from a button?

This usually happens when the button is an ActiveX control. ActiveX controls can hold the application focus, which prevents certain add-ins like Solver from running correctly. Standard Form Controls do not have this issue.

How do I make sure the Solver add-in is enabled?

Go to File > Options > Add-ins. At the bottom of the window, ensure 'Excel Add-ins' is selected in the Manage dropdown and click 'Go'. Check the box next to 'Solver Add-in' and click 'OK'.

Do I need to do anything inside the VBA editor for Solver to work?

Yes. To control Solver via VBA, you must establish a reference to it. Open the Visual Basic Editor, click on Tools > References, and check the box next to 'Solver'. If it is not in the list, click 'Browse' and locate the solver.xlam file.