Helping millions of people navigate the world of technology.

How to Create a Macro Button in Excel

Quick Tips
  • Accessing advanced Excel controls (including buttons) requires the Developer tab, which is hidden in the settings.
  • There are three main types of macro buttons: Form Control buttons (simplest), ActiveX buttons (more advanced), and Shapes (most customizable).
  • Learning to create Excel macro functions requires patience and VBA programming knowledge, as complex macros can be incredibly handy yet difficult to replicate.

If you find yourself repeatedly performing the same sequence of actions in Excel, chances are at least a part of the process can be automated with macros. Even though VBA coding (which is the only one that works in Excel macros) might be a bit tricky to grasp at first, it can be worth it. With a macro loaded onto the button, clicking on it runs through the macro in a second. Here’s how to create a macro button in Excel.

Part 1 – Enable the Developer Tab in Excel

Before you can create macro buttons, you need Excel’s Developer tools, which are hidden by default. The Developer tab contains all the controls necessary for both macros and buttons.

Step 1. Click on the “File” tab in the top-left corner.

Step 2. Select “Options” from the menu (you might need to click “More” first if Excel is in windowed mode).

Step 3. In the “Excel Options” dialog, click on “Customize Ribbon” on the left-side panel.

Step 4. In the right panel under “Main Tabs,” check the box for “Developer” and click “OK.”

How to Create a Macro Button in Excel 1

Step 5. Leave the settings.

The Developer tab should now appear in your Excel ribbon, giving you access to buttons, macros, and other advanced controls.

Part 2 – Creating a Button for the Macro

Form Control buttons are the simplest and most reliable option for most users and they work across most versions without compatibility issues.

Step 1. Go to the “Developer” tab and click “Insert” in the Controls group.

Step 2. Under “Form Controls” (the top section), select the “Button” icon (first option in the top row).

How to Create a Macro Button in Excel 2

Step 3. Click then drag with the mouse to draw the button where you want it to go. The “Assign Macro” dialog will automatically open once you release the left mouse button.

Step 4. In the “Assign Macro” dialog, choose one:

  • Select an existing macro from the list
  • Click “New” to create a new macro, which will open the Visual Basic Editor
  • Click “Record” to record a new macro
How to Create a Macro Button in Excel 3

Step 5. Once you’ve chosen or created a macro, click “OK” to assign the macro to your button.

Step 6. To customize the button’s text, right-click the button and select “Edit Text,” then type in your desired button label.

How to Create a Macro Button in Excel 4

Step 7. Click anywhere outside the button to apply the changes.

Option 2 – Create an ActiveX Control Button (Advanced Users)

ActiveX buttons offer more customization options and advanced programming capabilities, but they only work on Windows systems and may have compatibility issues across different Excel versions.

Step 1. Go to the “Developer” tab and click “Insert” in the “Controls” group.

Step 2. Under “ActiveX Controls” (the bottom section), select the “Command Button” icon.

How to Create a Macro Button in Excel 5

Step 3. Click and drag on your worksheet to create the button.

Step 4. When the button is created, you’ll see “Design Mode” is active (and highlighted in the Developer tab). Right-click on the button and select “Properties” to customize its appearance, text, and behavior.

How to Create a Macro Button in Excel 6

Step 5. To assign VBA code to the button, right-click it and select “View Code.” This opens the Visual Basic Editor with an empty click event procedure.

Step 6. Add your custom code between the “Private Sub CommandButton1_Click()” and “End Sub” lines. The number in the function’s title will change if you have other buttons.

How to Create a Macro Button in Excel 7

Step 7. Save and close the Visual Basic Editor, then click on “Design Mode” in the Developer tab to save all changes and get back to the sheet.

Option 3 – Create a Shape-Based Macro Button (Most Flexible)

Using shapes as macro buttons provides the most design flexibility, allowing you to create visually appealing buttons that match your worksheet’s aesthetic.

Step 1. Go to the “Insert” tab and click “Shapes” in the Illustrations group.

Step 2. Select any shape you prefer (rectangles and rounded rectangles work well for buttons).

How to Create a Macro Button in Excel 8

Step 3. Draw the shape on your sheet where you want the button to appear.

Step 4. Right-click on the shape and select “Assign Macro” from the context menu.

How to Create a Macro Button in Excel 9

Step 5. Add a macro or make a new one, then click “OK.”

Step 6. To add text to your shape, right-click it and select “Edit Text,” then input your button label.

Step 7. Use the formatting options in the “Shape Format” tab to customize colors, effects, and styles to make your button visually appealing.

Part 3 – Managing and Editing Macro Buttons

Once created, you may need to modify your macro buttons over time.

To change the assigned macro, right-click the button and select “Assign Macro,” then choose a different macro from the list or create a new one.

Editing button properties depends on the button itself:

  • Form Controls: Right-click and select “Format Control”
  • ActiveX Controls: Enable Design Mode, right-click, and select “Properties”
  • Shapes: Right-click and use formatting options from the context menu

To prevent other people from accidentally deleting Form Controls macro buttons, right-click on it, select “Format Control,” go to the “Properties” tab, and check “Don’t move or size with cells.”

You can also copy and paste the entire button and its macro assignment to other sheets or places within the same sheet via “Ctrl + C” and “Ctrl + V” while the button is selected.

How to Create a Macros in Excel

Unfortunately, VBA programming is beyond the scope of a simple tutorial. Your best bet is to create simple macros via the “Record” Macro feature, then see what happens when you change parameters and lines. You can refer to Microsoft’s VBA Learn platform for more details.

Was this helpful?

Thanks for your feedback!

Last updated on 20 June, 2025

Leave a Reply

Your email address will not be published. Required fields are marked *

The article above may contain affiliate links which help support Guiding Tech. The content remains unbiased and authentic and will never affect our editorial integrity.