Open In App

How to Create a Macro in Excel?

Last Updated : 01 May, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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.

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.


Similar Reads

Assigning Excel Macro to Objects
In Excel, a recorded macro can be assigned to different objects like a shape, graphic, or control note. Instead of running the macro from the required tool in ribbon, we can create these objects to run them easily. They get very handy when multiple macros are there. Individual objects can be created for different macros. In this article, let's disc
3 min read
Excel Personal Macro Workbook
When we create the macros for automation, they can be used for that particular workbook only. We cannot access them outside that workbook in others. Excel Personal Macro Workbook is a hidden workbook in your local system that pops up whenever you open the Excel application. It is a place where all the macros from any workbook can be stored and one
4 min read
How to Password Protect Your Excel Macro?
It is a best practice, to protect the Macro (VBA Code) from other users to edit or view. In this article, we explain to create a simple macro and protect the same "VBA Project" using a password in Excel from other users. Implementation: Follow the below steps to protect your excel macro with a password: Step 1: Open an excel file, to create a simpl
2 min read
How to Record a Macro in Excel
Excel Macro is simply a record button that records a set of actions performed on Excel that can be run multiple times. For example, if you have to format some raw data on a weekly basis you can use a macro to record yourself formatting the data once and let Excel automate the task in the future. it's used to help users save time and avoid performin
11 min read
How to Enable & Run a Macro in Excel? 6 Ways
We can record a macro in Excel or write from scratch in VB Editor. Excel provides different options to run a macro. In this article, we explore four different approaches to running a macro in an Excel application. Even while executing an Excel macro is a straightforward process for seasoned users, it might not be clear to newbies. You will discover
5 min read
What Does the Number in the Addchart2 VBA Macro represent?
A chart or graph can be made in an Excel spreadsheet by using the AddChart2 VBA macro. The desired chart type or style is indicated by the number in the AddChart2 VBA macro. The AddChart2 function uses this number as an input parameter to identify the type of chart or style to be constructed. Each chart type is given a different number. If change t
4 min read
How to Run a Macro Automatically
To run a macro automatically when the workbook opens one must enable the developer's tools in Microsoft Excel. What is a Macro in Excel Macros allows automating repetitive tasks in Microsoft Excel. Some tasks need to be performed multiple times and repetition of all the actions would consume time. In such type of Scenarios, Macros helps in automati
4 min read
Editing Excel Macros in Excel
Excel Macro is a set of actions that can be recorded, saved, used multiple times. This feature saves us a lot of time when dealing with repetitive tasks and huge data sets. We can always make changes to an existing Macro in Excel. There are two ways to record and run macros: Excel Commands Excel Visual Basic for Applications(VBA).1. Copying a Macro
1 min read
How to Create Dynamic Excel Dashboards Using Picklists?
Dashboards are a report technique that visually presents critical metrics or a data summary to allow for quick and effective business decisions. Excel is capable of handling complex statistical calculations, many of which are built-in as Functions and can be easily displayed on a dashboard. Excel dashboards allow for quick overviews of data reports
3 min read
How to Create a Line Chart for Comparing Data in Excel?
Excel is powerful data visualization and data management tool which can be used to store, analyze, and create reports on large data. It can be used to visualize data using a graph plot. In excel, we can plot different kinds of graphs like line graphs, bar graphs, etc., to visualize or analyze the trend. Line Chart for Comparing Data in Excel The li
3 min read
Article Tags :