In this post, you’ll learn about macros in Microsoft Excel and how you can add a macro to the toolbar in Excel workbook.
Add a Macro to the Toolbar
When you frequently use an Excel macro, you can add it to the Quick Access Toolbar. Hence, you can quickly access your macro.
For this you need to record an empty macro first.
- Under the Developer tab, click Record Macro.
- Name the macro as ‘Macro_For_Toolbar’.
- Click OK.
- Click Stop Recording.
- Open the Visual Basic Editor.
Enter the following code in the module
Sub Macro_For_Toolbar' () Activecell.value = "developerpublish" End sub
- This macro places your name in the Active Cell.
- Click save and then run it.
- Now we can add this macro to the Quick Access Toolbar.
- Click the down arrow on the top left of your screen and click More Commands.
- In Choose commands, select Macros.
- Select the macro and click Add.
- You can modify the button that will be added to the Quick Access Toolbar by clicking on Modify.
- Click OK .
- You can now execute the macro.
- To check whether the program works, select a cell and click on the button added to the Quick Access Toolbar.
When you close Excel, Excel prompts you to save the changes you made to the Personal Macro Workbook.
Click Save to store this macro in a hidden workbook that opens automatically when Excel starts.
So that the macro will be available to all your workbooks.