Open In App

How to Configure Macros in Excel

Last Updated : 13 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

An action or collection of actions can be recorded, named, stored, and executed as many times as necessary and whenever desired using an Excel macro. We can automate repetitive data manipulation and reporting processes that need to be done repeatedly by using macros. You can record a macro and save it with any name to run it whenever you open the workbook that contains this macro.

What are Macros in Excel

Macros in Excel are the recorded sets of actions and these actions can be executed to do repetitive tasks or perform complex operations.

A Macro is a sequence of commands or cations that you record, and run whenever needed. Macros in Excel are created using the Virtual Basic for Application(VBA) programming language.

How to Create Macros

This can be divided in two ways as follows: 

1. How to Record a Macro 

Tip: While recording a Macro the user should be careful because a macro records everything even what went wrong and you have corrected it, so it is advisable to practice the task you want to perform once or twice before recording it.  

Recording a Macro is a method that allows you to store the tasks performed by you. To Record a Macro the Developer tab on the Ribbon needs to be activated. The Developer tab contains all the Macro tools among the various other features. 

2. How to Run a Macro

You can easily run a macro, once you have recorded and saved it into a workbook.

After recording a macro one needs to Run a macro to make use of it. Users can run a macro using the Macro command on the developer tab that is present on the Ribbon. To Run a Macro user can press a combination of shortcut keys, By clicking a button on the Quick Access toolbar or in a custom group in the ribbon.  

How to Record a Macro in Excel

Step 1: Open a new Excel Workbook. 

Step 2: Turn on the Developer Tab on the ribbon (The Developer tab is by default hidden).

To personalize the ribbon, do the following, Anywhere on the ribbon, use the right mouse button to choose (by clicking) Customize the ribbon.

select the customize ribbon.

 

Step 3: Place a check in the Developer checkbox by selecting Customize the ribbon from the menu. Click “OK”.

Step 4: The developer tab has been added to the ribbon. To configure a macro, on the Developer tab, go to Code group and click Record Macro.

Click on record macro to record a macro.

 

Step 5: You’ll see the Record Macro dialogue box.  

Give your macro a name and specify the shortcut that will run it. Click “OK.”

Things to remember

The macro name should start with a letter and contain no space, symbol, or punctuation marks.

  • Shortcut key(optional): The shortcut key must be unique, for example, it shouldn’t be ctrl+v which is for paste
  • Description: This is useful for you and the user for understanding the purpose of the macro.
Record-macro-dialogue-box-opens

Give the macro its name, shortcut key, and description.

Note: Every step you perform from now on will be recorded by the macro. For Example, We added some sample data in Book 1.

Sample-data-added

sample data 

Let’s now change the header’s format and add some colors.

Changing-header-format

changing the header’s format 

Step 5: Once you are done, go to the developer tab and click stop recording. The macro has recorded the steps.

New-data-added

all activities are recorded.

How to Run a Macro in Excel

You can now perform the same steps by running the macro

Step 1: Open a new sheet (or wherever you want to run a macro) in Excel, and add the data.

Note: To see the recorded macro, Click on Macros in the Developer ribbon: 

Recorded-macros

A list of recorded macros can be seen 

Step 2: Select the name of Macro. Click Run.

Running-macros

select the macro 

You could see the changes recorded in Macro are applied in the sheet.

Changes-in-recorded-macro-seen

Recorded macros 

FAQs on Macros

What is the shortcut to view all Macros?

The shortcut key to view all macros is  “ALT +F8”

What is the use of Macro in Excel?

  • Macros are recording of your daily routine task so that if the user wants to repeat the task it can be easily done by clicking a single button.
  •  Macros can be used to record the steps of inserting the data and formatting it.  

What is the Macro-Enabled Format?

If you want to save your macro then you must save your workbook of macros in macro-enabled format i.e. *.xlsm 

How do I enable macros in a specific Excel file?

  1. Open your Excel file.
  2. Find and click the “Info” tab.
  3. Enable the macro content.
  4. Check your next session

How to delete a Macro?

Step 1: Click on the Developer tab, and Click Macros. 

Step 2: From the list, click on the Macro, you want to delete, and click on the delete button.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads