Skip to content
Related Articles

Related Articles

Improve Article

How to Create a Macro in Excel?

  • Last Updated : 01 May, 2021

Macros are a set or sequence of instructions that perform as and when required by the user. Initially, a macro is to be recorded. Then the macro is being executed in order to perform a set of a predefined set of commands in Microsoft Excel. Macros save a huge amount of time in performing a set of repetitive actions.

To perform a macro, one needs to record a macro using the following steps.

Attention reader! Don’t stop learning now. If you are an Excel beginner (or an intermediate) and want to learn Excel, Geeksforgeeks brings the perfect course for you to start, Diving Into Excel

Step 1: Open Excel. Then go to File tab and select options bar.

Step 2: Select customize ribbon option and make sure developer checkbox is selected.



Step 3: Select Ok . Developer menu will appear in the ribbon. 

Step 4: Select Developer tab and click on record macro. It will start recording a macro. It will then record the various steps. Click on stop recording to stop recording a macro.

Step 5: A new dialog box will open. Select the name of the macro and assign a shortcut key for the macro.  You can use current workbook, new workbook , or personal macro workbook to store the macro. Click Ok to continue.

Running a Macro:

Follow the below steps to run a macro:

Step 1: In both the views and developer tab from the ribbon, there is a option to run macros . Select the Macros option from the tab.



Step 2: From the open dialog box , select the macro and run it. You can also run the macro by using the shortcut  key mentioned at the time of saving the macro.

Create a button to link macro:

Follow the below steps to link macro to a button:

Step 1: Go to  Insert tab. Select Illustrations. Then, select shape and select the desired shape.

Step 2: Add text to the  shape , right click on it and select Edit Text. Enter the text of your choice.

Step 3: Then right click on the button, and select assign Macro.

Step 4: Select the corresponding macro from the dialog box.

Step 5: On clicking the specific shape, the designated macro will run.

My Personal Notes arrow_drop_up
Recommended Articles
Page :