• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer
EDUCBA

EDUCBA

MENUMENU
  • Resources
        • Excel Charts

          • Histogram Chart Excel
          • Basic Excel Formulas
          • Text to Columns in Excel
        • Excel Charts
        • Excel Tips

          • Excel Gantt Chart
          • IFERROR with VLOOKUP
          • Data Table in Excel
        • Excel Tips
        • Excel Tools in Excel

          • Stacked Column Chart
          • Cheat Sheet of Excel Formulas
          • Excel Data Validation
        • Histogram chart in excel
        • Others

          • Resources (A-Z)
          • Excel Functions
          • Financial Functions in Excel
          • Logical Functions in Excel
          • Lookup Reference Functions in Excel
          • Maths Function in Excel
          • TEXT and String Functions in Excel
          • View All
  • Free Courses
  • All Courses
        • Certification Courses

          Excel Course 1
        • All in One Bundle

          All-in-One-Excel-VBA-Bundle
        • Excel course

          Excel-Training
        • Others

          • Excel advanced course
          • VBA Course
          • Excel Data Analysis Course
          • Excel for Marketing Course
          • Excel for Finance Course
          • View All
  • 120+ Courses All in One Bundle
  • Login

Record Macro in Excel

Home » Excel » Blog » Excel Tools » Record Macro in Excel

Record Macro in Excel

Record Macro in Excel (Table of Contents)

  • Record Macro in Excel
  • How to Record Macro in Excel?

Record Macro in Excel

Macro by definition is a set of instructions, which are used to perform a particular task.

Start Your Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

Macro is an automatic repetitive task sequence, which is used to replace a repetitive task of keystrokes and use of mouse actions. Basically, what we repeatedly do in an excel project we can use a macro to do that for us. For example, if we have few formulas which are going to be repeated whether there is any data change or not we can use a macro to do that for us instead of us doing the same task again and again over and over.

In technical terms, Macro enables a user to trim downtime normally used in repetitive tasks. Macros can contain functions formulas logics etc.

Macro is created by recording a sequence of keyboard and mouse actions using the built-in macro recorder function in Excel. When a macro is recorded it can be used again by assigning a keyboard shortcut or from the View macro function.

There are two ways to use Excel Macros:

  • Macro Recorder: We can record our steps or certain tasks by excel record macro function and call it whenever required by any assigned hotkey or calling it from View Macros.

As in Example 1, we created a macro to fetch department list of employees.

Record Macro

  • VBA Editor: In VBA editor, we write a set of codes in VB language and perform certain tasks in the worksheet.

As in Example 2, we prompted user about the new code and called in the other macro to fetch the department list.

Popular Course in this category
Cyber Week Sale
Excel Advanced Training (14 Courses, 21+ Projects) 14 Online Courses | 21 Hands-on Projects | 129+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.8 (2,665 ratings)
Course Price

View Course

Related Courses
Excel Training (18 Courses, 9+ Projects)

VBA Editor

How to Record Macro in Excel?

Record Macro in Excel is very simple and easy to create. Let’s understand the working of Record Macro in Excel by some Examples.

You can download this Record Macro Excel Template here – Record Macro Excel Template

Record Macro in Excel – Example #1

In a workbook, we have two sets of data in two different worksheets. From sheet 2 we want some data in sheet 1. Normally we use V-lookups to find the data. But we can use the macro recorder to do the same for us.

data in sheet 1

This is data in sheet 1 and data in sheet 2 shown as below,

data in sheet 2

Suppose we want the Department Name in Sheet 1 for the respective employees. Now we can use the simple V-lookup function for this.

V-lookup function

The Output is:

Result of V-lookup function

But if the sheet is in the same format and the data gets changed then we have a task which is again repeated over and over. Macro in Excel comes in handy here. We can record the same steps using the excel macro tool and make excel do the same tasks for us. Let us learn to use the Excel Macro Recorder tool.

  • Firstly, Go to Views Tab and in the rightmost corner, there is an option of macros.

Record Macro Example 1-4

  • Click on Record Macro

Record Macro Example 1-5

  • A dialog box pops up.

Record Macro Example 1-6

  • In the dialog, Box there is a box to name the macro and assign a shortcut key. We can write a small description of the macro too.

Record Macro Example 1-7

(Tip: Do not use space in Excel macro Name)

  1. Click ok and we can see that Excel has started recording our sequence.

Record Macro Example 1-8

  1. Now perform the tasks required to fetch the department name from sheet 2, i.e. V-lookup from sheet 1.

VLOOKUP Formula is applied in Sheet 1.

Record Macro Example 1-9

It gives the desired output in Sheet 1 as in Sheet 2.

Record Macro Example 1-10

Select the remaining cells and Press Ctrl +D to get rest results.

Record Macro Example 1-11

  1. Now our task is complete, we click on stop recording.

Record Macro Example 1-12

  1. Under the View tab in the macros section, we can check that our macro has been recorded from the view macros option.

Record Macro Example 1-13

If we click on view macros option it shows the macro name which we added. Here it is Dept_List.

Record Macro Example 1-14

  1. Delete the data under Dept Column to check whether our macro is working or not.

Record Macro Example 1-15

  1. Press CTRL + D and see the result.

Press CTRL + D

We have successfully recorded and tested our first Macro.

Record Macro in Excel – Example #2

Prompt a message to run the above V-lookUp Macro.

Example 1 was a tool by excel which is used to record a macro. Now we will use VBA to create a macro. For this, we need to activate the developer tab.

Go to Files and then to options.

Step 1

In the customize ribbon toolbar on the right-hand side there is a checkbox with a name “Developer”. Mark the checkbox as check and click ok.

Step 2

Before getting started with VBA, we need to get some basics.

A VBA Code contains variables declarations logic and functions, which sums up as a whole code.

First, we need to follow some steps to create a macro-code.

  • Select the workbook in which we want to use the macro. In the current example, our target workbook is sheet 1.
  • In the developer Tab click on Visual Basic, It opens a VB Editor for us.

Step 3

  • Right, Click on the Object where we want to write our code, which is sheet 1, and goes to insert than to Insert Module.

Step 4

  • Now we can start writing Code in the Module. We open our function by SUB() function.

Tip: We use sub () procedure as its main purpose to carry out a particular task or action.

Record Macro Example 2-4

  • Now write the following code in the Sheet.

Record Macro Example 2-5

Message box function gives a prompt to a user as VBA Code and then macro, which was recorded as Dept_List will be called.

  • When we click on Run in the VBA Editor it gives us the following prompt.

Record Macro Example 2-6

Record Macro Example 2-7

  • We Select VBA Project Module4. New Code as the Macro to Run and excel first gives us a prompt and then the Department List.

Record Macro Example 2-8

Record Macro Example 2-9

Then the Department List will be updated,

Record Macro Example 2-10

Tip: Excel with Macro should be saved as *.xlsm as Excel Macro-Enabled workbook to save the macros in it.

Explanation of Excel Macro:

Macros are used to reduce the repetitive tasks, which are done on daily basis. A set of tasks are recorded and can be accessed over and over. It can be accessed by a menu list or from some hotkeys defined by the user.

If we go by definition, Macro is a set of rules or patterns, which specifies how a certain input sequence should be mapped to a certain output sequence according to a defined procedure.

Things to Remember About Record a Macro in Excel

  • Macro Name should not contain space.
  • A macro should be saved as “Excel Macro-Enabled Workbook” and extension as *.xlsm.
  • Before writing any VBA code we need to activate developer Tab from customizing ribbon button in the options.
  • Excel Macro Recorder has its limitations but we can virtually automate anything from Excel VBA.

Recommended Articles

This has been a guide to a Record Macro in Excel. Here we discuss how to create Record Macro in Excel examples and downloadable excel templates. You may also look at these useful functions in excel –

  1. PROPER Function in Excel
  2. Guide to VLOOKUP Function in Excel
  3. How to Use MIRR Excel Function?
  4. SUMIF Function in Excel – You Must Know

All in One Excel VBA Bundle (120+ Courses, 30+ Projects)

120+ Online Courses

30+ Projects

500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

4 Shares
Share
Tweet
Share
Reader Interactions
Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar
Excel Functions Tutorials
  • Excel Tools
    • Power Query in Excel
    • Power View in Excel
    • XML in Excel
    • Excel Evaluate Formula
    • Examples of Excel Macros
    • Consolidation in Excel
    • Ribbon in Excel
    • Excel Conditional Formatting for Dates
    • Protect Sheet in Excel
    • Data Model in Excel
    • Pivot Table Examples
    • Pivot Table Slicer
    • Pivot Table Filter
    • Watch Window in Excel
    • Slicer in Excel
    • Print Gridlines in Excel
    • Convert Numbers to Text in Excel
    • Freeze Columns in Excel
    • Spelling Check in Excel
    • Name Box in Excel
    • Solve Equation in Excel
    • Excel Spreadsheet Examples
    • What If Analysis in Excel
    • How to Print Labels From Excel
    • Excel Named Range
    • Excel TRANSPOSE Formula
    • Excel Merge and Center
    • Excel Freeze Rows
    • HLOOKUP Formula in Excel
    • Excel Create Database
    • Excel Gridlines
    • Excel Spreadsheet Formulas
    • Excel Sort By Number
    • Excel Concatenating Columns
    • Excel AutoCorrect
    • Conditional Formatting For Blank Cells
    • Excel Icon Sets
    • Excel CTRL D
    • Excel Accounting Number Format
    • Excel Regression Analysis
    • Excel Import Data
    • Excel Freeze Panes
    • Excel Calendar
    • Excel Developer Tab
    • Excel Enable Macros
    • Excel Autosave
    • Heat Map in Excel
    • Excel Toolbar
    • Excel Error Bar
    • Excel Status Bar
    • Excel Unprotect Sheet
    • Check mark in Excel
    • Excel Column Filter
    • Excel Header and Footer
    • Excel Drawing
    • Range in Excel
    • Timeline in Excel
    • Excel Lock Formula
    • Excel Table styles
    • Insert New Worksheet in Excel
    • Excel Column Lock
    • Excel Forms for Data Entry
    • QUOTIENT in Excel
    • Excel Sorting
    • Excel Sort by color
    • Excel Data Bars
    • Excel Tool for Data Analysis
    • Excel Flash Fill
    • Excel Auto Fill
    • Excel Quick Access Toolbar
    • Excel Wrap Text
    • Excel Exponential Smoothing
    • Excel ANOVA
    • Excel Merge Two Tables
    • Excel Conditional Formatting in Pivot Table
    • Dynamic Tables in Excel
    • Excel Sort by date
    • Excel Dynamic Range
    • Record Macro in Excel
    • Two Variable Data Table in Excel
    • Merge Cells in Excel
    • One Variable Data Table in Excel
    • Excel Fill Handle
    • CheckBox in Excel
    • Excel Table
    • Excel Combo Box
    • Auto Format in Excel
    • Advanced Filter in Excel
    • Excel AutoFilter
    • Excel Data Filter
    • Excel Data Validation
    • Excel Radio Button
    • Data Table in Excel
    • Text to Columns in Excel
    • Excel List box
    • Excel Solver Tool
    • Scrollbar in Excel
  • Excel Functions (10+)
  • Financial Functions in Excel (17+)
  • Logical Functions in Excel (12+)
  • Lookup Reference Functions in Excel (30+)
  • Maths Function in Excel (39+)
  • TEXT and String Functions in Excel (25+)
  • Date and Time Function in Excel (20+)
  • Statistical Functions in Excel (55+)
  • Information Functions in Excel (4+)
  • Excel Charts (44+)
  • Excel Tips (195+)
  • VBA (180+)
  • Workplace Productivity (4+)
  • Microsoft Office Tools (14+)
  • Excel Formula and Functions (20+)
  • MS Excel Shortcuts (4+)
Excel Functions Courses
  • EXCEL ADVANCED Training
  • EXCEL Training COURSE
Footer
About Us
  • Who is EDUCBA?
  • Sign Up
  •  
Free Courses
  • Free Online Excel Course
  • Free Vba Course
Certification Courses
  • All Courses
  • Excel VBA Course - All in One Bundle
  • VBA Course
  • Excel Data Analysis Course
  • Excel for Marketing Course
  • Excel for Finance Course
  • Excel for HR Training
Resources
  • Resources (A To Z)
  • Excel Charts
  • Excel Tips
  • Excel Tools in Excel
  • Excel Functions
  • Financial Functions in Excel
  • Logical Functions in Excel
  • Lookup Reference Functions in Excel
  • Maths Function in Excel
  • TEXT and String Functions in Excel
  • Date and Time Function in Excel
  • Statistical Functions in Excel
  • Information Functions in Excel
Apps
  • iPhone & iPad
  • Android
Support
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions

© 2019 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

Download Record Macro Excel Template

By continuing above step, you agree to our Terms of Use and Privacy Policy.
EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

Let’s Get Started
Please provide your Email ID
Email ID is incorrect

Limited Period Offer - All in One Excel VBA Bundle (120+ Courses, 500+ hours of Videos) View More

Limited Period Offer - Limited Period Offer - All in One Excel VBA Bundle (120+ Courses, 500+ hours of Videos) View More