How do I add a macro button to the ribbon in Excel?
T JoinedApr 6, 2020Messages3Office Version
Hi Y JoinedNov 23, 2018Messages281
you may have to use a CustomUI to add your macro to the ribbon. Learn from here T JoinedApr 6, 2020Messages3Office Version
For those that might be interested, i managed to find a work around. VBA Code: The above code creates a temporary new ribbon, which would normally vanish if you were to close then re-open Excel. By putting this in the Add-in and naming the sub Aut And, we’ll use this code to assign to macro buttons which we placed in a module, it will return the used row numbers in our active sheet. 1. Using Control Button to Create a Macro ButtonFirstly, we’ll apply the Control buttons from the Developer ribbon to build a macro button. You will get two types of buttons here, the Form Controls button and the ActiveX Controls button. Both perform the same kind of operations but ActiveX Controls provides more customizations, formats, and features. 1.1. Using Form Control ButtonFrom the Form Controls section, we’ll apply the first control button named- Button. Steps:
Then your cursor will look like this- a plus sign.
Macro is assigned successfully, you can change the button name too. By dragging the eight circular icons beside the box, we can edit the size of the macro button.
See, a notification box is showing the output. 1.2. Using ActiveX Control ButtonNow we’ll use the Command Button from the ActiveX Controls buttons. But instead of assigning macro, we’ll have to type the code here. Steps:
By using the other menu you can edit the macro button as you required.
Now just by clicking the button, we’ll be able to run the codes. Read More: Key Differences in Excel: Form Control Vs. ActiveX Control 2. Inserting Shapes to Create a Macro ButtonWe know, Excel has a Shapes feature in the Insert ribbon. The amazing part is, we can assign macro with any kind of shape too. Steps:
A few moments later, the Assign Macro dialog box will appear.
Read More: How to Assign Macro to Button in Excel (2 Easy Methods) Similar Readings
3. Using Quick Access Toolbar to Make a Macro ButtonThe previous method was to set a button in a sheet but what if we could make a button that we could use anytime for any sheet? Maybe it will be very useful for some particular situations. Here we’ll add this type of button to the Quick Access Toolbar. Steps:
Have a look, the button is available in the toolbar. Now it doesn’t matter which sheet you are in, you will get it available for any sheet.
The output after clicking on the button. Read More: How to Edit a Macro Button in Excel (5 Easy Methods) ConclusionThat’s all for the article. We hope the procedures described above will be good enough to create a macro button in Excel. Feel free to ask any question in the comment section and please give us feedback. Visit ExcelDemy to explore more. What Ribbon tab contain macro controls?The Developer tab is a very useful addition to the Excel ribbon that allows you to access a number of advanced features such as VBA macros, ActiveX and Form controls, XML commands, and more.
How to add a macro to excel?Right-click the control, and then click Assign Macro. The Assign Macros dialog box appears. To specify the location of an existing macro, select where the macro is located in the Macros in box by doing one of the following: To search for the macro in any workbook that is open, select All Open Workbooks.
|