![]() ![]() That’s it! Now the shape would work as a button and whenever you click on it, it will run the assigned macro. In the Assign Macro dialogue box, select the macro you want to assign to the shape and click the OK button. This opens the Assign Macro dialogue box. Right-click on the shape and select the Assign Macro option. You can also insert any text in the shape by simply selecting it and typing the text. In the example above, I have changed the size, color, and border. Resize/Format the shape the way you want. It will insert the shape object in the worksheet. ![]() Insert any shape to which you want to assign the macro. In the Illustrations group, click on the Shapes icon. ![]() Even if you share the workbook with someone who has no knowledge of VBA, he/she can just click on the button and see the actions take place (without even knowing what happens in the back end).Ĭlick the Insert tab. The benefit of this method is that it makes it really easy and intuitive for anyone to run the macro. One of the easiest ways to run a macro is to have a button in the worksheet and click that button to execute the macro. Now let’s see various ways to run this macro in Excel. This one line code would fill the cell A1 of the active sheet with red color. How to Run a Macro in Excel #įor the purpose of this tutorial, let’s say we have a macro named ‘ColorCell’ with the following code: If you’re interested in learning VBA the easy way, check out my Online Excel VBA Training. In this tutorial, I’ll show you different ways to run a macro in Excel. In Excel, you can create a macro by recording it or by writing code in the VB editor. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |