You make a button in Excel by inserting a shape or a form control and then assigning a macro (or a hyperlink) to it. The fastest route is Developer > Insert > Button (Form Control), drag a rectangle on the sheet, then pick the macro you want it to run. If your ribbon has no Developer tab, you enable it once under File > Options > Customize Ribbon. The steps below cover that setup, the two main button types, and how to make a button that simply jumps to another sheet without any code at all.
Two button styles exist in Excel and they are not the same thing. A form control button (also called a button shape) is the one you can create from the Developer tab and assign a recorded macro to. It is simple, works in every desktop version, and is the right choice for nearly all routine work. An ActiveX command button is a more programmable object with its own events and properties; it needs VBA behind it and can behave differently across platforms, so it is mainly for advanced users. A plain shape with a hyperlink is a third, no-code option that is useful when you only need navigation. Ribbon and menu labels can differ slightly by version, device and region, and the Developer tab is not shown on Excel for the web, so the instructions here are for Excel on Windows and Mac desktop.
What You'll Need
- Excel for Windows or Mac installed on your computer (the Developer tab is not available in Excel for the web).
- A workbook saved as an .xlsm macro-enabled file if your button will run a macro; a normal .xlsx file will not keep VBA code.
- The Developer tab turned on in the ribbon.
- Macro security set so that macros can run: File > Options > Trust Center > Trust Center Settings > Macro Settings. Choose the option that disables macros with notification, or enable macros only from trusted locations, rather than leaving them fully blocked.
- Optional: a short macro you have already recorded, or code you plan to paste in. If you have no macro yet, record one from Developer > Record Macro first.
Step-by-Step
- Turn on the Developer tab. Go to File > Options > Customize Ribbon. In the right-hand list of main tabs, tick Developer, then click OK. On Mac, the path is Excel > Preferences > Ribbon & Toolbar, where you tick Developer in the list of tabs. The tab appears across the top of the window.
- Save the workbook as macro-enabled. Use File > Save As and choose Excel Macro-Enabled Workbook (.xlsm). If you skip this, any macro you attach to a button will be lost when you close the file, and Excel will warn you about it.
- Record or write the macro. On the Developer tab click Record Macro, name it something short and clear with no spaces (for example FormatReport), perform the actions you want the button to repeat, then click Stop Recording. To write code instead, click Visual Basic, insert a module in the project, and type or paste your procedure. Every macro must begin with Sub Name() and end with End Sub.
- Insert the button. On the Developer tab click Insert, then under Form Controls choose the Button icon (the grey rectangle). The cursor turns into a small cross. Drag a rectangle on the sheet where you want the button. A dialog box appears asking you to assign a macro.
- Assign the macro. Select your macro in the list and click OK. Excel names the button automatically (Button 1, Button 2 and so on). You can also leave the assignment for later and add it with a right-click, as described below.
- Rename the button. Right-click the button and choose Edit Text, then type a label that says exactly what happens, such as Refresh Summary or Go to Dashboard, and click outside the button. A label people understand is more useful than a generic one.
- Test it. Click any cell to deselect the button, then click the button itself. The macro should run. If the button feels stuck and you cannot select or move it, press Ctrl and click it (or right-click it) to edit it, or turn off Design Mode on the Developer tab.
- Position and size it. Drag the button by its border to move it. Right-click and use Size and Properties to set an exact size, or to fix the button to the cell beneath it so it moves and sorts with that cell rather than floating loose on the sheet.
- Make a no-code button with a shape. If you only need a button that opens another sheet or a link, go to Insert > Shapes, pick a rectangle or rounded rectangle, and draw it. Right-click the shape, choose Add Hyperlink, then select Place in This Document and pick the target sheet or cell. Style the text and fill from the Shape Format tab. This button needs no macro and works in files saved as .xlsx.
- Copy and reuse. To add more buttons, hold Ctrl (or Option on Mac) and drag an existing button to duplicate it, then right-click the copy and Assign Macro to point it at a different procedure. Save the file.
Common Mistakes
The most frequent problem is creating the buttons in a normal .xlsx workbook. Excel saves the buttons but discards the attached code on close, so you must switch to .xlsm and save before doing any macro work. A second common error is leaving macros blocked by the Trust Center or by the yellow security bar at the top of the sheet: the button appears to do nothing until you enable content. Third, people paste recorded code without matching the Sub name to the macro name shown in the Assign Macro list, which leaves the dialog empty. Fourth, labels are left as Button 1 and Button 2, which gives no clue what each one does. Finally, buttons are placed over data cells without being fixed to a cell, so they drift out of place when columns are resized or rows are sorted. Set the placement property to move and size with cells if the layout matters.
Tips
Give each macro a short, descriptive name and keep a plain-language comment at the top of the code explaining what it does. Choose a consistent button size and colour for the same kind of action, so a user can tell a refresh button from a print button at a glance. Keep buttons in one row or column rather than scattering them across the sheet. If a button should not be moved or overwritten, protect the sheet from Review > Protect Sheet after testing, since locking cells can also prevent editing the button. Keep a backup copy of the macro-enabled workbook before making big changes, and avoid editing macros on a shared drive while others have the file open. If you hand the file to someone else, tell them to click Enable Content so the macros run.
Troubleshooting
If the button does nothing, check the yellow macro warning bar first and enable content. Next, confirm the file is saved as .xlsm and that the macro name in the Assign Macro dialog matches an existing procedure. If the code shows a compile error, open Visual Basic and check for a missing End Sub, a renamed macro or a typo in a sheet or range reference. If you cannot select or move the button, you are probably in Design Mode; toggle it off on the Developer tab. If clicking the button selects the cell behind it, hold Ctrl and click, or right-click and choose Assign Macro again. If the button jumps around when rows are sorted, use Size and Properties to set it to move and size with cells. If the Developer tab is missing, re-check Customize Ribbon; on a managed work computer an administrator may have hidden it, in which case you cannot switch it back on yourself. If macros are blocked entirely by a policy, a shape with a hyperlink is the workable alternative for navigation-only buttons.
Frequently Asked Questions
Do I need the Developer tab to make a button?
Only for form control and ActiveX buttons that run macros. A shape with a hyperlink created from Insert > Shapes works on any ribbon setup and needs no Developer tab.
Will the buttons work if someone opens my file?
The buttons appear, but macros stay disabled until the other person clicks Enable Content, provided your Trust Center settings allow macros with notification. Without that, the buttons will look normal and do nothing.
Can I make a button in Excel for the web?
No. Excel for the web does not offer the Developer tab, so you cannot insert macro buttons there. Shape-based hyperlink buttons are also limited in the browser version; create the buttons on the desktop app instead.
What is the difference between a form control button and an ActiveX button?
A form control button is the simple button you assign a macro to. An ActiveX command button has extra properties and event code, needs more VBA knowledge, and is best avoided unless you specifically need its features.
Can one button run several actions?
Yes. Put all the steps inside a single macro, or have one macro call others in sequence, then assign that one macro to the button.
How do I delete a button?
Right-click the button and choose Cut, or select it and press Delete. The macro code stays in the workbook; only the on-sheet button is removed.