How to Add a Button in Excel

HomeExcel BasicsHow to Add a Button in Excel

In Excel, users can add macro-enabled buttons on the worksheets and can run macros by just clicking on them.

Users can use these macro-enabled buttons to perform several different tasks like filtering data, selecting data, printing a worksheet, running formulas, and calculations just by clicking on the buttons.

Adding buttons and embedding the macros to them is easier. Excel has multiple ways to add the macro-enabled buttons to the worksheet.

Below, we have some quick and easy ways mentioned for you to add the macro buttons in Excel.

Add Macro Buttons Using Shapes

Users can create buttons in excel using shapes. Creating buttons using shapes has more formatting options over the buttons created from Control buttons or ActiveX buttons.

Users can change the design, color, font, and style of the button created using shapes.

  • First, go to the “Insert” tab and then click on the “Illustrations” icon” then click on the “Shapes” option and select any rectangle button.
illustration-shapes-icon
  • After that, with the help of a mouse, draw the rectangular button on the worksheet.
draw-a-rectangular-button
  •  Now, to enter the text in the button, double-click on the button and insert the text.
enter-text-to-the-button
  • For formatting, go to the “Shape Format” tab and you will get multiple options for the formatting of the button.
  • From here, you can format the font style, font color, button color, button effects, and much more.
shape-format-tab
  • To edit the text, add the hyperlink, or add the macro, just right-click on the button and you will get the pop-up menu with multiple options.
  • From here, you can edit the text, add the hyperlink, and can add the macro to the button.
  • Now, select the “Assign Macro” option to add the macro to the button.
right-click-on-the-button
  • Once you select the “Assign Macro” option, you will get the “Assign Macro” dialogue box opened.
  • From here, select the macro and click OK.
assign-macro-window
  • At this point, the button has become micro enabled, and when you move your cursor on the button, the cursor turns to the hand point cursor.
micro-enabled-button
  • To freeze the button movement, right-click on the button and select the “Format Shape” and select the option “Don’t move or size with cells”.
freeze-the-button

Add Macro Buttons Using Form Controls

  • First, go to the “Developer” tab and click on the “Insert” icon under the “Control” group on the ribbon.
developer-tab
  • After that, select the first button option from the “Form Controls” menu and draw a button on the worksheet.
form-controls-button
  • Now, select or type the macro name from the “Assign Macro” dialogue box and click OK.
  • If you don’t have any macro created yet, you can click Cancel to add the macro at a later stage.
assign-macro-dialogue-box
  • From here, right-click on the button and select “Assign macro” to add the macro to the button if did not assign yet.
  • To format the button font size, style, color, etc. select the “Format Control” option.
right-click-the-button
  • Once you click on “Format Control”, you will get the “Format Control” window open and then can do the button font formatting.
format-control-window
  • To freeze the button movement, select the “Properties” tab and select the option “Don’t move or size with cells” and click OK.
freeze-the-button-movement

Add Macro Buttons Using ActiveX Controls

  • First, go to the “Developer” tab and click on the “Insert” icon under the “Control” group on the ribbon.
developer-tab-insert-icon
  • After that, select the first button option from the “ActiveX Controls” menu and draw a button on the worksheet.
activex-controls-button
  • Now, to create and insert the macro to the button, click on the “View Code” icon to launch the VBA editor.
view-code
  • Now, select the” CommandButton1” on the subprocedure and choose the “Click” option from the drop-down list on the right side of the editor.
vba-editor