How to Create a Macro in Excel: Build, Run, and Use Macros Easily
How Do I Create a Macro in Excel- Quick Steps
- Open MS Excel > Start Recording a Macro
- Perform the Actions You Want to Automate > Stop Recording
- Run the Macro
Are repetitive tasks consuming your time in Excel? With this Excel macros tutorial, you can learn how to create and use macros in Excel to automate tasks and improve efficiency. This guide will walk you through the essentials, from understanding what macros are to creating a macro button for quick access. Whether you’re a beginner looking for a step-by-step guide to Excel macros or someone eager to explore advanced features, this article provides everything you need to make and run a macro with ease.

How to Create a Macro in Excel
Table of Content
What is Macro in Excel
An Excel Macros is a set of instructions that you can create to automate repetitive tasks. Think of it like a recorded script that performs actions such as formatting cells, entering data, or generating reports, all with just a single click. This helps save time and reduces the chance of errors when doing the same task over and over. Creating a Macro in Excel takes some basic steps to complete that will be covered in the given article.
Uses of Macros in Excel
Macros in Excel help automate repetitive tasks, making work faster and more efficient. Here are some common uses:
- Automating Repetitive Tasks: Macros can quickly perform repetitive actions, such as data entry, formatting cells, or applying formulas, saving time and reducing errors.
- Data Analysis and Manipulation: Automate data sorting, filtering, and calculations to make data analysis faster and more consistent.
- Generating Reports: Create complex reports automatically by recording the steps required, such as gathering data, applying filters, and formatting.
- Data Validation: Automate data checks, validations, and corrections to ensure data accuracy.
- Customizing Excel Functions: Macros can be used to create custom functions tailored to specific needs, enhancing Excel’s built-in functionality.
- Importing and Exporting Data: Automate data imports from external sources or exports to other formats with just a single click.
- Simplifying Complex Workflows: Automate complex sequences of tasks, making it easier to complete detailed processes consistently.
Macros help streamline Excel tasks, making it a powerful tool for productivity and data management.
How to Create a Macro in Excel
Creating a macro in Excel allows you to automate repetitive tasks, saving time and increasing productivity. Macros are written in Visual Basic for Applications (VBA), but you can create them either by recording your actions or by writing VBA code manually. Here’s how to create a macro in Excel:
Step 1: Enable the Developer Tab
To create or record macros, you need to enable the Developer Tab in the Excel ribbon.
- Open Excel and go to File > Options.
- Click Customize Ribbon from the left-hand menu.
- Check the box for Developer under the “Main Tabs” section.
- Click OK. The Developer tab will now appear in the ribbon.

Enable the Developer Tab
Step 2: Record a Macro in Excel
Recording a macro in Excel is simple and allows you to automate repetitive tasks. Follow these steps to record your first macro:
- Go to the Developer Tab and click Record Macro in the “Code” group.
- Name the Macro:
- Enter a descriptive name (e.g.,
FormatData
). - Optionally, assign a shortcut key (e.g.,
Ctrl + Shift + F
). - Choose where to store the macro:
- This Workbook: Macro is saved in the current workbook.
- Personal Macro Workbook: Macro is available across all workbooks.
- Enter a descriptive name (e.g.,
- Click OK to start recording.
- Perform the actions you want to automate (e.g., formatting cells, applying filters).
- Go back to the Developer tab and click Stop Recording once you’re done.

Developer tab>>Select “Record Macro”>>Enter “Macro Name”>>Enter “Shortcut”>>Press ok
How to Run a Macro in Excel
Running a macro in Excel is quick and easy. Follow these steps to execute a macro:
Step 1: Open Microsoft Excel and Select Your Workbook
- Open the Excel workbook containing the macro you want to run.
- Ensure macros are enabled for the workbook:
- Go to File > Options > Trust Center > Trust Center Settings > Macro Settings and enable macros.
Step 2: Go to the Developer Tab and Select the Macros Option
- Click on the Developer Tab in the ribbon.
- If the Developer Tab is not visible, enable it via File > Options > Customize Ribbon.
- In the “Code” group, click on Macros.

Click on Macros
Step 3: Run the Macro
- In the Macro dialog box that appears:
- Select the macro you want to run from the list.
- Click Run.
- Alternatively, use the shortcut key (if you assigned one while creating the macro) to execute the macro directly.
How to Create a Macro button in Excel
Creating a macro button in Excel allows you to run macros with a single click. Here’s how to link a macro to a button:
Step 1: Insert a Shape
- Go to the Insert Tab in the ribbon.
- In the Illustrations group, select Shapes.
- Choose the desired shape (e.g., rectangle, circle) and draw it in your worksheet.

Insert a Shape
Step 2: Add Text to the Shape
- Right-click on the shape and select Edit Text.
- Enter a descriptive label for the button, such as “Run Macro” or the name of the macro.

Add Text to the Shape
Step 3: Assign a Macro to the Shape
- Right-click on the shape again and select Assign Macro from the drop-down menu.
Step 4: Select the Corresponding Macro
- In the Assign Macro dialog box:
- Select the macro you want to assign from the list.
- Click OK.
Step 5: Test the Macro Button
- Click on the shape (your button) to run the assigned macro.
- Ensure the macro performs the desired action.

Select Assign Macro
Easy Tips for Creating a Macro
Here are some easy tips for creating a macro in Excel to improve your productivity:
1. Plan Your Steps
Before recording a macro, outline the steps you want to automate. This ensures nothing is missed during the recording process, helping you create efficient Excel macros.
2. Use the Macro Recorder
- Go to the View tab, select “Macros”, and click “Record Macro”.
- Perform the tasks you want to automate.
- Click “Stop Recording” when you’re done.
3. Give Your Macro a Clear Name
Use descriptive names for your macros so you can easily identify their purpose (e.g., “FormatReport”). This helps in managing multiple Excel VBA macros.
4. Create a Shortcut Key
Assign a shortcut key for easy access, but ensure it doesn’t conflict with common Excel shortcuts for smoother use.
5. Test Your Macro
Run your macro on a test sheet to ensure it works as expected, reducing potential errors.
6. Use Relative References (if needed)
Click “Use Relative References” when recording if you want your macro to apply to different cells based on your selection.
7. Edit the Macro (Optional)
Go to “Macros” > “View Macros“, select your macro, and click “Edit” to refine the VBA code if you have some coding experience.
These macro creation tips make automating tasks in Excel easy, helping you save time and work more efficiently!
Also Read
Conclusion
Creating a Excel macro is a straightforward process that can significantly enhance your productivity and efficiency. By creating a macros in Excel, you can save valuable time and ensure consistency in your work. To create a macro, simply enable the Developer tab, record your actions, and then save the macro for future use. Whether you’re formatting data, generating reports, or performing complex calculations, macros can streamline your workflow and reduce errors. In the above article we have explore how to create a macro in Excel by some simple and easy steps.
How to Create a Macro in Excel – FAQs
How do you create a macro in Excel?
Follow the steps given below to create a macro in Excel:
- Open MS Excel
- Go to the Developer Tab
- Select Customize Ribbons
- Record your Macro
- Stop Recording
How to Make a Macro on Mac?
To create a macro on Mac in Excel:
- Enable the Developer Tab: Go to Excel > Preferences > Ribbon & Toolbar and check Developer.
- Record Macro: In the Developer tab, click “Record Macro”, name it, and add an optional shortcut.
- Perform Actions: Carry out the steps you want to automate.
- Stop Recording: Click “Stop Recording” in the Developer tab.
- Run Macro: Go to Developer > Macros, select your macro, and click Run.
How to create a macro in excel without recording?
To record a macro in Excel without recording follow the step given below:
- Open Excel
- Enable the Developer Tab
- Open the VBA Editor
- Insert a New Module
- Write Your VBA Code
- Save Your Macro
How do I create a personal macro in Excel?
The steps of creating a personal are also same as the steps for creating macro in Excel.
- Go to the Developer Tab
- Select Customize Ribbons
- Record the Macro in your Personal Workbook
- Stop Recording
What is the use of macros in excel with examples?
Here are some key uses of macros in Excel:
- Data Entry: Automate the entry of repetitive data to save time and reduce errors.
- Formatting: Apply consistent formatting to cells, rows, or columns across multiple worksheets or workbooks.
- Sorting and Filtering: Quickly sort and filter large datasets based on specific criteria.
- Data Cleaning: Remove duplicates, correct data errors, and standardize data formats.
- Statistical Analysis: Perform statistical calculations, such as averages, standard deviations, and correlations.
How to enable macros in Excel?
Follow the steps given below to enable the macros in Excel:
- Open Excel
- Access Excel Options
- Navigate to Trust Center Settings
- Adjust Macro Settings
- Enable Macros for a Specific Workbook