Once a Microsoft Excel macro has been created, it needs to be ran by the user for it to perform the desired tasks. There are several ways to run macros. The methods I use the most are detailed below.
I typically run macros from the Visual Basic Editor (VBE) when testing new code and/or troubleshooting issues. Use the steps below to run a macro through the VBE.
1. Click the Developer menu tab in the menu ribbon at the top of the screen. Review this post if the Developer tab is not visible for you.
2. Click the Visual Basic button at the top left of the screen.
3. Use the VBA Project window on the left side of the screen to navigate to appropriate spreadsheet and the appropriate module within the spreadsheet.
4. Use the Code window scroll bar or the dropdown menu at the top right of the Code window to navigate to the appropriate program within the module.
5. Click anywhere in the code of the macro you want to run. This will ensure the appropriate program is active.
6. Click the Play button (button with the green triangle) at the top of the screen to run the macro. You can also access the Play button by clicking the Run button at the top of the screen.
Once I have completed the layout of the spreadsheet and the macros I want to use, I typically insert shapes into the spreadsheet and assign a macro to each shape. I can then simply click a shape when I want to run the macro assigned to it. This will work with any object (shape, image, etc.).
1. Insert a shape. This can be done several ways. For example, click the Insert menu tab in the menu ribbon at the top of the screen. Click the Illustrations dropdown menu followed by the Shapes dropdown menu. Then select the desired shape.
2. Add text to each shape that will identify the macro you will assign to it. To do this, click on an inserted shape then type the word or phrase you want to use.
3. Right-click on the shape and select the Assign Macro option.
4. Click on the macro you want to assign to the selected shape to highlight it in the Macro Names window.
5. Click the OK button to assign the macro.
You can also run macros using a combination shortcut key, which is a combination of key(s) on the keyboard that will be pressed at the same time to run the macro.
1. Click the Developer menu tab in the menu ribbon at the top of the screen. Review this post if the Developer tab is not visible for you.
2. Click the Macros button at the top left of the screen.
3. Click on the macro you want to create a shortcut for to highlight it in the Macro Names window.
4. Click the Options button.
3. In the Shortcut Key box, type any lowercase or uppercase letter that you want to use as the combination shortcut key for the selected macro.
Note, for Windows, the shortcut key for lowercase letters is Ctrl + the letter chosen and the shortcut key for uppercase letters is Ctrl + Shift + the letter chosen. For Mac, the shortcut key for lowercase letters is Option + Command + the letter chosen and the shortcut key for uppercase letters is Ctrl + Shift + the letter chosen.
Be careful when assigning shortcut keys as they will override any default Excel shortcut key with the same combination while the workbook that contains the macro is open.
Copyright © 2024 sheetsfreaks - All Rights Reserved.
Powered by GoDaddy
We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.