How to Assign a Macro to a Button in Excel (Easy Guide)
- -- By Sumit Bansal
While there are many different ways to run a macro in Excel, none of those methods can be as easy and user-friendly as clicking on a button.
And for that to work, you need to assign a macro to a button first.
In this tutorial, I will show you a couple of ways to insert a button in Excel and then assign a macro to that button (or shape). Once done, as soon as a user clicks on the button, the macro VBA code would be executed.
For the purpose of this tutorial, I will be using the below VBA macro code (which simply selects cell A1 in the active sheet and enters the text “Good Morning” in it and colors it red).
The above VBA code is placed in a regular module in the VB Editor
Now let’s dive right in and see how you can assign this macro to a button or shape in Excel!
This Tutorial Covers:

Insert a Shape and Assign Macro to that Shape
While there are dedicated buttons that you can insert in the worksheet and then assign the macro to it, I will first cover how to assign a macro to a shape .
I personally love this method and prefer it over the rest two methods covered later. You can easily insert a shape (square or rectangle) and can make it look like a button.
And since it’s a shape, you can easily format it to look perfect with your existing formatting or brand colors.
Below are the steps to insert a shape in Excel:
- Resize the rectangle and format it (give it a border, color, shade if you want).
After you have done the above steps, you will have a rectangle shape in the worksheet, and now we will assign a macro to this shape.
Now let’s see how to assign a macro to this shape.
- Right-click on the shape on which you want to assign the macro
- In the Assign Macro dialog box, you will see a list of all the macros that you have in the workbook
- Click on OK
That’s it!
The selected macro has now been assigned to the shape.
Now when you hover the cursor over the shape, it will show the hand icon. which indicates that now this shape has become clickable.
And now if you click on the shape, it will run the assigned macro .
You can type any text within the shape to make it more intuitive (such as ‘Click here to run the macro’). To do this. right-click on the shape and then click on Edit Text. Now you can type within the text box shape.
Note that you won’t be able to click and run the macro when the shape has been selected (i.e., you see a border around the shape that appears when you select it), To make it clickable, hit the Escape key or click anywhere in the worksheet.
Also, when you have assigned the macro to the shape already, you will not be able to select it by using the left mouse key (as it has become clickable and left-click would now execute the macro). In that case, select the shape, hold the control key and then press the left key.
Keeping Shape Visible When you Hide/Resize Rows/Columns
In Excel. when you insert a shape, it sits over the cells – like a chart/object.
This also has a drawback that when you resize or hide rows/columns that have the shape over it, the shape also follows suit.
In the below example, the shape gets hidden when I hide the column on which it’s placed.
If you don’t want this to happen, follow the below steps:
- Right-click on the shape
- In the Format Shape pane (or dialog box in case you’re using Excel 2010 or prior versions), select Size and Properties
- Close the pane (or dialog box)
Now, when you resize rows/columns or hide these, the shape would stay in its place.
Assign a Macro to Form Control Button
If you’re not too concerned with the formatting of the button and are ok with regular gray buttons, you can quickly insert it from form control (or ActiveX control as shown next) and then assign a macro to it.
For this to work, you will need to have the Developer tab in your ribbon. If you don’t have it, here is a detailed step-by-step tutorial on getting the developer tab in the Excel ribbon .
Once you have the developer tab visible, you can use the below steps to quickly insert a button and assign a macro to it:
- Click anywhere on the worksheet. This will insert the button wherever you click and automatically open the ‘Assign Macro’ dialog box.
The above steps would insert a button that has the specified macro assigned to it.
By default, it would be a small button with text such as ‘Button’ written on it. You can change the text to whatever you want and can also change the shape of the button (by dragging the edges).
Since this is an object that is placed over the worksheet (just like shapes/charts), you can drag and place it anywhere in the worksheet.
One drawback of using the Form Control button is that you don’t have much control over the formatting. For example, you can not change the color from gray to something else.
Although there is a little bit of formatting that you can do with a Form control button, it’s nowhere close to what you can do with shapes.
You get these button formatting options when you right-click on the button and then click on Format Control.
This will open the Format Control dialog box where you can change the font type/color, size, alignment, etc.
One good thing about this button is that it doesn’t hide or resize when you hide the rows/columns or resize them. It would, however, move in case you change the height or width or the row/column over which the button is placed.
In case you don’t want the button to stay in its place, you can change the setting by following the below steps:
- Right-click on the button
- Click on Format Control
- Click on the Properties tab
Assign a Macro to an ActiveX Control Button
Apart from the Form Control button, there is also an ActiveX control button to which you can assign a macro.
In most cases, you won’t need to use the ActiveX control button, and I recommend you use it only when you completely understand what it is and you know what you’re doing.
This also, sometimes, make ActiveX a bit glitchy and unpredictable. So, while I cover it in this tutorial, I don’t recommend using ActiveX button and assign a macro to it.
To insert an ActiveX button and then assign a macro to it, follow the below steps:
- Click on the Developer tab
- In the Control group, click on Insert.
- Click anywhere on the worksheet. This will insert the button wherever you click.
- Double-click on the button and it will open the VB Editor backend where you can place the code for the ActiveX button
With ActiveX control, you get a lot more flexibility with a single button. For example, you can specify one macro to be run when you simply click on the button once and another macro when you double-click or even another one when you use the up/down arrow key.
Again, not something you need to be using in your regular work.
Hope you found this tutorial useful. If you’re interested in learning VBA, you can check out more in-depth Excel VBA tutorials here .
You may also like the following Excel tutorials:
- How to Record a Macro in Excel
- Creating a User Defined Function (UDF) in Excel VBA
- Excel VBA MsgBox [Message Box]
- Useful Excel Macro Examples for VBA Beginners
- How to Remove Macros From an Excel Workbook
- How to Enable Macros in Excel?
FREE EXCEL BOOK
Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster
1 thought on “how to assign a macro to a button in excel (easy guide)”.
Following the procedure here, I cannot assign a Macros from an *.xlam workbook (addin). Is there a way to do this? thx
Leave a Comment Cancel reply
BEST EXCEL TUTORIALS
Best Excel Shortcuts
Conditional Formatting
Excel Skills
Creating a Pivot Table
Excel Tables
INDEX- MATCH Combo
Creating a Drop Down List
Recording a Macro
© TrumpExcel.com – Free Online Excel Training
Privacy Policy | Sitemap
- PRO Courses Guides New Tech Help Pro Expert Videos About wikiHow Pro Upgrade Sign In
- EXPLORE Tech Help Pro About Us Random Article Quizzes Request a New Article Community Dashboard This Or That Game Popular Categories Arts and Entertainment Artwork Books Movies Computers and Electronics Computers Phone Skills Technology Hacks Health Men's Health Mental Health Women's Health Relationships Dating Love Relationship Issues Hobbies and Crafts Crafts Drawing Games Education & Communication Communication Skills Personal Development Studying Personal Care and Style Fashion Hair Care Personal Hygiene Youth Personal Care School Stuff Dating All Categories Arts and Entertainment Finance and Business Home and Garden Relationship Quizzes Cars & Other Vehicles Food and Entertaining Personal Care and Style Sports and Fitness Computers and Electronics Health Pets and Animals Travel Education & Communication Hobbies and Crafts Philosophy and Religion Work World Family Life Holidays and Traditions Relationships Youth
- Browse Articles
- Learn Something New
- Quizzes Hot
- This Or That Game New
- Train Your Brain
- Explore More
- Support wikiHow
- About wikiHow
- Log in / Sign up
- Computers and Electronics
- Spreadsheets
- Microsoft Excel
How to Create a Custom Macro Button in Excel
Last Updated: July 28, 2022
wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 13 people, some anonymous, worked to edit and improve it over time. This article has been viewed 483,089 times. Learn more...
Macros in Excel can save a great deal of time with repetitive tasks. By assigning macros to custom buttons, you can save even more time by bringing your macro only one-click from execution.

- Click File → Options → Customize Ribbons
- Find the Developer check box in the Main Tabs section and click it. Press "OK" when you are done.

- Go to Excel → Preferences → Ribbon (Under Sharing and Privacy)
- Under Customize, check the box next to the Developer tab, and press "OK"

- If you are unfamiliar with what macros are or how to record them , read more. You should have a macro already built before you create the button.

Expert Q&A
Video . by using this service, some information may be shared with youtube..
- Try using the 2003 method for Excel versions earlier than 2003. Thanks Helpful 0 Not Helpful 0
- Alternatively, you may add your macro button to an existing toolbar in versions 2003 and earlier. Thanks Helpful 0 Not Helpful 0
- If you prefer, it will let you assign a shortcut key in the dialog box. This can prevent wrist strain and save time. Thanks Helpful 0 Not Helpful 0

- The user interface on versions earlier than 2003 may be different so the 2003 method may not be exactly the same for those versions. Thanks Helpful 2 Not Helpful 0
- If you want a different button image than what version 2007 offers, you will need to download additional software that specializes in modifying user interfaces for Microsoft Office. Thanks Helpful 2 Not Helpful 0
You Might Also Like

- ↑ http://office.microsoft.com/en-us/excel-help/add-a-button-and-assign-a-macro-to-it-in-a-worksheet-HP010342137.aspx
About This Article
- Send fan mail to authors
Is this article up to date?

Featured Articles

Trending Articles

Watch Articles

- Terms of Use
- Privacy Policy
- Do Not Sell or Share My Info
- Not Selling Info
wikiHow Tech Help Pro:
Level up your tech skills and stay ahead of the curve
- Advanced Tutorial
- Tips and Tricks

- VBA Tutorial
Excel VBA: Assigning Macros to Buttons
Assign macro to a button.

Now right-click on this button and click Assign macro .

Dialog box appears. Choose the macro which you want to assign.

Macro is now assigned to the button. To run the macro just click the button.
To unassigned macro right-click on the button. Click Assign macro from the list. Dialog box appears. To unassigned the macro just erase macro’s name and leave it blank.

RELATED ARTICLES MORE FROM AUTHOR
Excel Toggle Button: Streamline Interactivity
Excel vba tutorial: master the visual basic editor, excel vba while wend loop: automating tasks, editor picks, excel borders and shades: enhancing cell appearance, ms word text formatting: style your content, features of ms excel: unleashing productivity, vba nested if statement: multilevel conditions, mac excel shortcuts: boosting productivity.

EVEN MORE NEWS
POPULAR CATEGORY
- Office Tools 674
- MS Excel Tutorial 429
- Functions 330
- Tips and Tricks 276
- Functions Examples 188
- Basic Tutorial
- VBA Examples
- Functions Examples
- Compatibility Excel Formulas & Functions
- Data Analysis
Excel VBA Variable Declaration: Macro Programming
Top Contributors in Excel: HansV MVP - Jim_ Gordon - Ashish Mathur - Andreas Killer - Shane Devenshire 👏
November 13, 2023
Top Contributors in Excel:
HansV MVP - Jim_ Gordon - Ashish Mathur - Andreas Killer - Shane Devenshire 👏
- Search the community and support articles
- Microsoft 365 and Office
- Search Community member
Ask a new question
Assign Macro to Ribbon Button
Report abuse, replies (4) .
Was this reply helpful? Yes No
Sorry this didn't help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
Thanks for your feedback.
- Volunteer Moderator |
- Article Author
Well, it can be done. Sort of.
Programmatically you can create a "toolbar" which appears on a new tab of the Ribbon called "Add-ins." Unfortunately, the Add-ins tab is not global. It is only for one window at a time.
Tips on how to make such a toolbar and assign a macro to one of its buttons are here:
http://www.mrexcel.com/forum/excel-questions/28674-assigning-macro-commandbar-visual-basic-applications.html
Just to follow up a bit more...
I've seen RibbonX appear in the Visual Basic Editor in Excel 2016 for the Mac. Microsoft has been hinting heavily that Ribbon customization is coming to Office for Mac. Putting 2+2 together I suspect that RibbonX support could be on its way. You might want to read-up on RibbonX. http://www.bing.com/search?q=Ribbonx+VBA+excel
You can use XML and RibbonX to customize the Ribbon in the 15.15 update to Microsoft Office 2016 for Mac. See this blog posting for details:
http://dev.office.com/blogs/VBA-improvements-in-Office-2016
Question Info
- Norsk Bokmål
- Ελληνικά
- Русский
- עברית
- العربية
- ไทย
- 한국어
- 中文(简体)
- 中文(繁體)
- 日本語
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Create a Custom Menu That Calls a Macro
- 5 contributors
The following code example shows how to create a custom menu with four menu options, each of which calls a macro.
Sample code provided by: Holy Macro! Books, Holy Macro! It's 2,500 Excel VBA Examples
The following code example sets up the custom menu when the workbook is opened, and deletes it when the workbook is closed.
The menu "MyFunction" is added when the workbook opens, and is deleted when the workbook closes. It provides four menu options, with a macro assigned to each option. The user-defined function (UDF) "MyFunction" multiplies three values in a range together and returns the result.
Formula Entry: This menu option is assigned the macro "Cbm_Active_Formula", which calls the UDF named "MyFunction" that multiplies the numbers in the preceding 3 cells, and stores value of the UDF in the active cell. You must have values in the range B6:D6 and select cell E6 before clicking this menu option.
Value Entry: This menu option is assigned the macro "Cbm_Active_Value", which enters the value produced by the UDF named "MyFunction" into the active cell. You must have values in the range B6:D6 and select cell E6 before clicking this menu option.
Formula Selection: This menu option is assigned the macro "Cbm_Formula_Select", which uses an InputBox for the user to select the range which the UDF "MyFunction" should calculate. The return value of the UDF is stored in the active cell.
Value Selection: This menu option is assigned the macro "Cbm_Value_Select", which uses an InputBox for the user select the range which the UDF "MyFunction" should calculate. The value is stored in the active cell directly, instead of being returned by the UDF.
About the Contributor
Holy Macro! Books publishes entertaining books for people who use Microsoft Office. See the complete catalog at MrExcel.com.

Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Was this page helpful?
Submit and view feedback for
Additional resources
Free All-in-One Office Suite with PDF Editor
Edit Word, Excel, and PPT for FREE.
Read, edit, and convert PDFs with the powerful PDF toolkit.
Microsoft-like interface, easy to use.
Windows • MacOS • Linux • iOS • Android

- Articles of Excel
- Excel-How-to
How to Add a Button in Excel (Easy & Quick)
People found many difficult tasks in their workplace data management projects, especially while dealing with data in Excel in bulk. So, they can add a button in excel to resolve most of their problems in one click.
In this article, you will come to know some learning aspects about how to add a button in excel without a macro and with how to add a button in excel with a macro – if you want or need it. You can have the most simple and easy steps ahead to follow to solve more than half of the problems while using Excel data dealing.
Types of Button Available in Excel
In Excel, you can have the opportunity to hyperlink the Button to specify some of the entries in the data to manage the entire sheet in an organized form. Therefore, it is necessary to understand how many types of Buttons are available in Excel.
Basically, Excel has two types of Buttons available that are Form Controls and ActiveX Controls, that can add convenience to your work.
What are Form Controls?
Form Controls are the compatible and original Excel controls used in the XLM macro sheet. Moreover, you can use the form controls to give a reference, interact, or redirect someone to the specified location, making the interacting data cell clickable without using the VBA code.
There are buttons in the Form Control below; you can see the screenshots for your comprehensive understanding.
What are ActiveX Controls?
ActiveX Controls are also found in Excel features used in worksheet forms with or without macro or VBA code. If you want to have more flexible design requirements in your spreadsheet containing data and other information in bulk, you can use the ActiveX Form Controls to manage it in an organized and professional way by clicking on a clickable section of the interactive cell in the worksheet.
2. Preparation Before Adding Buttons in Excel
To work up to snuff in the management and features of data in excel and to create a button in excel, you should first get some preparations before you add buttons in the excel workbook.
In this article, you will come to know the basics and difficult techniques in a very simple and easy method, which is helpful for you during implantation in your own spreadsheet data at a desired location.
Enable/Visible Developer in Excel Ribbon Before Adding Buttons in Excel
First, before you go to add a button in excel, it is necessary to insert the Developer option in the top Excel Ribbon. For this purpose, you can get a simple guide from below mentioned comprehensive steps:
Step 1: In the Excel file section, directly go to the last portion containing the Options tab.
Step 2: In the Options section, go to the Customize Ribbon in Excel once a dialogue box will appear to you.
Step 3: Next to it, a dialogue box will appear to Customize the Ribbon that can add a Developer option by marking it tick.
Step 4: Mark the box of the Developer section to allow it to appear on the Excel top ribbon location.
Step 5 : After enabling the Developer in the Excel ribbon, you can check it after pressing; you will see there are options that can help you easily add a button in Excel.
3. How to Add Form Buttons in Excel
There is a simple step-by-step method to add a button in Excel that can improve the functionality and productivity of your work.
Add Form Buttons in Excel (Using Form Controls)
Step 1 : In the Developer section, go to the Insert icon that falls under the Controls group.
Step 2: In the Form Controls, there is a Button option at first; click on it in drag-drop style.
Step 3: After selecting the designation name of the macro in the Assign Macro box, click OK.
Step 4: You can set the macro in the Assign Macro dialogue box and click OK.
Step 5 : You can format the styling, formatting, size, color, or whatever changes you want to make; you can simply go to the Format Control option.
Step 6 : When you click on the Format Control, a window will open where you can make changes in font or other formatting.
Step 7 : Next to it, you can freeze the movement by going to the Properties tab, marking the section Don’t move or size with cells, and clicking OK very next to it.
Add a Button (Form Control)
If you want to add a button in the data easily Excel sheet with form control, here you can have a few simple steps that you can follow to add a button in Excel without macro in the easiest way.
The first step you need to consider is enabling the Developer tab, which is hidden by default in Excel.
Step 1 : In the Developer section, there is the Controls group; click Insert and further click on Button under the section of Form Controls.
Step 2: Where you want that Button to appear, you can click here and manage the Assign Macro pop-up window.
Step 3: Once you are done with the settlement of Assign Macro, go with the OK.
Step 4: Now right-click on the Button and select Format Controls to specify the control properties on the selected location of a workbook.
4. How to Add ActiveX Buttons in Excel
If you are finding ways to add the ActiveX buttons in Excel to enable the command button in your Excel workbook sheet containing a lot of sheets and make your work look professional. So, you have to simply follow these steps to add ActiveX buttons in Excel, which can also be helpful for you to add a button in Excel with a macro. Here you go!
Step 1 : In the Developer section, there is the Controls group; go and click Insert and then click the Command Button option under the ActiveX Controls section.
Step 2: Click on the desired location where you want to add the command button.
Step 3 : In the Controls section, just click on the View Code. Make sure that the Click process is drop-down on the right list of a spreadsheet. You can run the macros when you set the Command Button 1_Click in the box that appears. Simply select the message and make desirable changes in the ActiveX Buttons in Excel.
Further, if you want to include the macro Button in your Excel sheet, you can simply consider the below-mentioned steps to improve your data in an organized way. Please let’s have a look below:
Step 1: Go to the Developer section; in the Control group section, click Insert, and in the Insert section, click Button under the Form Controls.
Step 2: Select the desired location in the worksheet where you want to appear; the Button in the upper-left corner, as the Assign Macro screen will appear in front of you.
Step 3: Once you assign a macro button, now click on OK.
Step 4: You can click on Format Control to specify the control properties in the selected section by right-clicking on the Button.
5. Best Free Alternative to Microsoft Excel - WPS Office
WPS Office suite is the most reliable innovation that is greatly helpful for everyone, providing feature-rich programs Excel, Word, PowerPoint, PDF, and more, becoming a market leader in increasing office productivity.
WPS Office is a free tool giving reliable all-in-one services currently has more than 494 million active users worldwide – representing how significant and popular WPS Office is. It is one of the best free alternatives to Microsoft Office, providing additional features without advertisements.
Advantages of WPS Office Suite
Free to Use
Rich Functions
Additional Tools
Best Editor
Strong Compatibility
User-Friendly Interface
Download WPS Office Suite
Step 1: You can visit the main official site of the WPS office suite: https://www.wps.com/ and click on the Free Download option.
Step 2: Once done with clicking on download, it asks for installation on your PC, so click on the Install Now option after agreeing on the WPS office policy license.
Step 3 : Now, WPS Office will start downloading in your device system within in few seconds.
Step 4 : The main working screen will appear after the WPS Office is launched on your PC, Mac, or Android.
Step 5: In the main home screen of the WPS Office suite, you can see that there are additional tools that can help you process easily, making your work more professional.
Use Word, Excel, and PPT for FREE, No Ads.
Edit PDF files with the powerful PDF toolkit.
Microsoft-like interface. Easy to learn. 100% Compatibility.
Boost your productivity with WPS's abundant free Word, Excel, PPT, and CV templates.
Can I add a button to run the VBA code?
Yes, you can easily add a button to run VBA code in your Excel spreadsheet. In your Excel workbook, if it uses VBA code and you want others to run that code easily, then you can use a form control button, which is a great option.
Here are some simple steps that you can opt to add a button in the Excel sheet to run VBA code smoothly:
Step 1 : In the ribbon, go to the Developer section.
Step 2 : Simply click on the Insert tab in the Controls section.
Step 3 : Press on Button form control from the menu section.
Step 4 : Now right-click by holding the mouse and go for the drag and release to create your Button to run.
Step 5: You will see a pop-up of Assign Macro, so now go to Select the VBA Procedure that you want to run from your desired Button.
Step 6 : Click the OK option.
Can I assign multiple macros to a single button?
Yes, you can easily assign the multiple macros to a single button with VBA code; just do with the following steps mentioned below:
Step 1: After clicking on Developer, go to the Insert tab and click on Button (Form Control).
Step 2: By dragging the mouse, draw the Button on your current selected sheet. Also, in the Assign Macro box, click on the OK Button.
Step 3 : To open Microsoft Visual Basic for Applications, you can hold down the Alt + F11 key.
Step 4: Go to Module in the Insert tab and paste the code in the Module Window.
Step 5 : Click on Save. Now right-click the Button, then choose Assign Macro.
Step 6 : In the Assign Macro box, select the Button Click option with multiple macro options to add; now insert the name you want to have here and click on the OK Button.
Step 7: Whenever you click on the Button, the specified macros will appear on a single button after each trigger.
Be Ahead of the Curve
To make productive changes in your professional and business level work, you may interact with the frequent use of spreadsheets, where organizing the difficult tasks by the easiest method is necessary.
And it can happen when you learn how to add a button in Excel in 2023 – a fast-paced technological world.
To get better experience in learning how to add a button in Excel without macro, you may also want to know how to add a button in Excel with macro; both problems can easily be solved when you consider the most reliable and accessible tool – WPS Office Excel.
WPS Office is a free office suite containing Word, Excel, PowerPoint, PDF, and other essential features that help every user to get aided by it. Therefore, if you want to hyperlink the Button in Excel easily, you should install the WPS Office on your PC or Mac and be ready to benefit from it; solving your problem with WPS Office Excel – plays a significant role in boosting productivity and efficiency of work.
- 1. How to Fix Escape Button Not Working in Excel [Step-by-Step]
- 2. How to Calculate Profitability Index in Excel (Easy&Quick)
- 3. Enabling Dark Mode in LibreOffice Writer_ A Quick and Easy Guide
- 4. How to Remove Last Word from Cell in Excel (Easy & Quick)
- 5. How to Create a Pivot Table in Excel (Easy & Quick)
- 6. 6 Ways to Use Formulas in Excel for Multiplication (Easy&Quick)
15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.
Assign a macro to a button
You can use a button (a form control) to run a macro that performs an action when a user clicks it. For example, you might use a button to automate the printing of a worksheet, the filtering of data, or the calculation of numbers.
After you create a macro , you can assign it to a button you click to run the macro . You can assign a macro to a button on the Quick Access Toolbar or to a button in your own personal group on the ribbon.
If you want a macro button to be available in other workbooks, assign it to a macro that was created in a personal workbook .
Add a macro button to the Quick Access Toolbar
Click File > Options > Quick Access Toolbar .
In the Choose commands from list, click Macros .

Select the macro you want to assign a button to.
Click Add to move the macro to the list of buttons on the Quick Access Toolbar.
To replace the default macro icon with a different button for your macro, click Modify .
Under Symbol , select a button icon for your macro.

To use a friendlier name for the button, in the Display name box, enter the name you want.
You can enter a space in the button name.
Click OK twice.
The new button appears on the Quick Access Toolbar, where you can click it to run the macro.
Tip: When you save the workbook , buttons you assign to macros in the personal workbook will be available in every workbook you open.
Add a macro button to your own group on the ribbon
Click File > Options > Customize Ribbon .
Under Customize the Ribbon , in the Main Tabs list , check the Developer box if it is not already checked.

Pick the tab where you want to add your own group.
For example, pick Home , to add your group to the Home tab.
Select New Group .
That adds New Group (Custom) to the tab you picked.
To use a better name for your new group, click Rename , type the name you want in the Display name box, and then click OK .
You can enter a space in the name. For example, type My Macros .
To add a macro to the group, in the Choose commands from list, click Macros .
Select the macro you want to add to your new group, and then click Add . The macro is added to the My Macros group.
To use a friendlier name, click Rename , and then type the name you want in the Display name box.
You can enter a space in the name.
Your new group appears on the tab you picked, where you can click the button to run the macro.
Newer versions
On the Developer tab, in the Controls group, click Button .
If the Developer tab is not available
Go to Excel > Preferences... > Ribbon & Toolbar .
In the Customize the Ribbon section, under Main Tabs , check the Developer check box, and press OK.
Click the worksheet location where you want the upper-left corner of the button to appear.
In the Assign Macro dialog box, click the name of the macro that you want to assign to the button, and then click OK .
To resize the button, drag the sizing handles.
To specify the control properties of the button, Control+Click or right-click the button, and then click Format Control .
Excel 2011 for Mac
On the Developer tab, in the Forms Control group, click Button .
Under Customize , select the Developer check box.

Need more help?
Want more options.
Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Microsoft 365 subscription benefits

Microsoft 365 training

Microsoft security

Accessibility center
Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Ask the Microsoft Community

Microsoft Tech Community

Windows Insiders
Microsoft 365 Insiders
Was this information helpful?
Thank you for your feedback.

IMAGES
VIDEO
COMMENTS
To add a button to the ribbon, start by right-clicking anywhere on the ribbon or ribbon tabs. Then select Customize the Ribbon. This will open the Excel Options page, and Customize Ribbon should already be highlighted on the left-hand side.
Windows macOS After you create a macro, you can assign it to a button you click to run the macro. You can assign a macro to a button on the Quick Access Toolbar or to a button in your own personal group on the ribbon. If you want a macro button to be available in other workbooks, assign it to a macro that was created in a personal workbook.
1. Add Macro Button to Quick Access Toolbar 2. Add a Macro Button to Your Own Group on the Ribbon or Toolbar Things to Remember Frequently Asked Questions Conclusion 1. Using Excel Command Buttons to Assign Macro
Right-click on the shape on which you want to assign the macro In the menu options that appear, click on 'Assign Macro'. This will open the assign macro dialog box In the Assign Macro dialog box, you will see a list of all the macros that you have in the workbook Click the Macro name that you want to assign to this shape.
Windows macOS Macros and VBA tools can be found on the Developer tab, which is hidden by default. The first step is to enable it. For more information, see the article: Show the Developer tab. Add a button (Form control) On the Developer tab, in the Controls group, click Insert, and then under Form Controls, click Button .
In the Options dialog select Customize Ribbon > Customize the Ribbon > Main Tabs and add a check-mark in the box for "Developer", and click OK. Add a Macro Button In Excel, select the Developer tab, then click on the " Insert " dropdown in the Controls section.
Introduction In this tutorial, you'll see how to add your macros to a custom tab on the Excel Ribbon. The My Macros sample file has a custom tab with 10 buttons, and 2 drop down lists. You can choose label text, button images, and which macro each button should run.
To assign a macro to a custom button on the Quick Access toolbar, follow these steps: Click the Customize Quick Access Toolbar button at the end of the Quick Access toolbar and then click More Commands on its drop-down menu. Excel opens the Excel Options dialog box with the Quick Access Toolbar tab selected.
7. Select Macros from the list on the left. 8. Click and drag the Custom Button icon from the list on the right to your new toolbar. The new button is represented by a smiley face. 9. Right-click on the newly added button. 10. Rename the button to your liking or leave the default name in the Name: field.
Microsoft security Accessibility center Training: In this final video, we'll hook the macro up with a button and make it available in two places: In a custom group on the Developer tab, and on the Quick Access Toolbar.
Honestly, an add-in loading with XLSTART, and assigning the macro to a quick/ribbon button might be simpler. - Cyril Jan 10, 2017 at 16:55 @Cyril yes indeed, to show up on the sheet as opposed to the Ribbon or Quick Access Toolbar (I should've been more specific).
Right-click on the Ribbon or QAT and select "Customize Quick Access Toolbar". 19. Click on the box below where it says "Choose commands from" and then click on the name of the custom Ribbon tab that you created in step 7. 20. Click on one of the custom macro buttons that you want to add to the QAT. 21.
Excel 2013 training Work with macros Assign a button to a macro Overview Transcript In this final video, we'll hook the macro up with a button and make it available in two places: In a custom group on the Developer tab, and on the Quick Access Toolbar. Want more? Create or delete a macro Edit a macro Assign a macro to a button
In this lesson you can learn how to assign macro to a button (or other object).First let's prepare some button. Go to Ribbon > Insert > Shapes and select Rectangle. Then insert the shape in the workbook and name it (if you want). Now right-click on this button and click Assign macro.
A a_ford Created on October 2, 2015 Assign Macro to Ribbon Button Just like on the PC, I want to assign a macro to a button and have that button live in the ribbon. I can do it on the PC, but can't figure out how to do it on the Mac (Office 2016). Am I missing something? This thread is locked.
It provides four menu options, with a macro assigned to each option. The user-defined function (UDF) "MyFunction" multiplies three values in a range together and returns the result. VB. Function MyFunction (rng As Range) As Double MyFunction = rng (1) * rng (2) * rng (3) End Function. Formula Entry: This menu option is assigned the macro "Cbm ...
Use keytips for ribbon controls instead of inventing something new. KeyTips are the keyboard shortcuts that appear on the Ribbon when you press the ALT key. You can assign your own KeyTips by using the keytip and getKeytip attributes. The getKeyTip callback has the following signature:. C#: string GetKeytip(IRibbonControl control) VBA: Sub GetKeytip (control As IRibbonControl, ByRef label) C++ ...
1) Get your VBA code. Let's have a code like this. It can be whatever you feel like. To do so, open VBA in the Developers tab or by pressing Alt+F11. Create a new Module, by right clicking on VBAProject > Insert > Module, name it sayMsg in the Properties window and enter the following code:
Access the Macros Dialog: Click on the "View" tab in the Word ribbon, go to the "Macros" group, and select "View Macros." Running a Macro. Select Your Macro: In the "Macros" dialog box, select the macro you want to run. Run the Macro: Click "Run" to execute the selected macro. Alternatively, you can assign the macro to a button or keyboard ...
Here are some simple steps that you can opt to add a button in the Excel sheet to run VBA code smoothly: Step 1: In the ribbon, go to the Developer section. Step 2: Simply click on the Insert tab in the Controls section. Step 3: Press on Button form control from the menu section.
Engineering. Computer Science. Computer Science questions and answers. assign the totals macro to the show totals button then run the macro using the macro button.
Click File > Options > Quick Access Toolbar. In the Choose commands from list, click Macros. Select the macro you want to assign a button to. Click Add to move the macro to the list of buttons on the Quick Access Toolbar. To replace the default macro icon with a different button for your macro, click Modify.