Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Adding Buttons to Your Worksheet.

Adding Buttons to Your Worksheet

Written by Allen Wyatt (last updated January 15, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

Probably the most commonly created control object for worksheets is the lowly button. This is because the most common use of buttons is to run macros which you have associated with a workbook. You can insert buttons in your worksheet by use of the Button tool. Follow these steps:

  1. Display the Developer tab of the ribbon.
  2. Click Insert in the Controls group. You'll see a small palette of items you can insert in your document.
  3. Click on the Button tool.
  4. Click in your workbook where you want a corner of the button to appear, but don't release the mouse button.
  5. Move the mouse to specify the size of the button you want.
  6. Release the mouse button.

Excel immediately displays the Assign Macro dialog box, offering you the opportunity to assign a macro to the button. Notice that the dialog box presents a list of previously defined macros, along with a suggested name for the macro to be assigned to this button. The suggested name is comprised of the default name of the button itself (something like Button1) combined with the action that will start the macro (Click). This macro name (Button1_Click) will appear very familiar to people that have programmed in Visual Basic before, since it conforms to the standard way of naming event handlers. (Event handlers are nothing but programming code designed to handle a specific event, such as an object—like a button—being clicked with the mouse.)

To complete your work with the Assign Macro dialog box, select a macro you want assigned to this new button and then click on OK. You can then change the title appearing on the button by clicking your mouse within the button text and entering a new title.

Once the button is finished in this manner, the macro associated with this button will be run whenever anyone clicks on it with the left mouse button. If you use the right mouse button instead, you will see a menu that allows you to delete the button or change the macro assigned to the button.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10485) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Adding Buttons to Your Worksheet.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Table Borders Won't Print

Print a table and you may be surprised if it has no borders. That could be because you actually have the borders turned ...

Discover More

Bogging Down with Calculated Items

Create a complex PivotTable and you may find that your system slows to a crawl. The reason for this may be due to the way ...

Discover More

Mouse Stops Working in Word

Could you use Word without the assistance of your mouse? For most people the answer would be a resounding "no." What are ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Specifying a Delimiter when Saving a CSV File in a Macro

You can, within a macro, save a workbook in several different file formats that are understood by Excel. However, you may ...

Discover More

Store Common Macros in the Personal Macro Workbook

Want your macros to be available regardless of the workbook on which you are working? Here's how to store them in the ...

Discover More

Calculating the Distance between the Top of the Window and Row 1

Normally Excel positions a UserForm in the center of your screen. You may want to position the form elsewhere, more ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 5?

2022-01-15 09:34:46

Dave Bonin

Buttons will do the job, but they're really boring to look at.

Personally, I prefer using rounded rectangle shapes...
- Insert tab > Illustrations group > Shapes > Pick the rounded rectangle
- After that, you can format the shape to apply colors, borders, 3-D effects, shadows, etc...

Why shapes?
- Because they offer a lot more formatting options AND you can assign a macro to them just like a button.

Why does formatting matter?
- Because buttons that look more like, well, buttons can make it more obvious to an otherwise newbie user that they are in fact buttons for him/her to click on.
- You can write macro code to change the button text and/or color to convey status changes.
- They just look better and more professional.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.