Dear Beginner,

In this Excel Macros Tutorial, you are going to learn the Basics of Excel Macro. This is the first Article of this Tutorial so Let’s begin with What is Excel Macro

What is Excel Macro ?

Let’s not get too much in detail at this point. For now, in simple language, Macro is very popular software available with the most of the windows applications. Many of the windows applications provide inbuilt Macro programming. For example: Excel, Word etc. Here in this blog you will be learning this how to use it in Microsoft Excel.

It allows you to perform multiple operations just by clicking a simple button or changing a cell value or opening a workbook etc. It enables you to work in a smart and efficient way. In terms of productivity, it is very productive as it reduces lots of manual work and gets the things done very fast especially things which you are doing it repeatedly.

So, is it a programming language?

For now, Yes, it is very similar to Visual Basic. You don’t need to know much about the history of this language at this point of time. If you are interested and want to know history of this Language you can read this article. It is a video tutorial, where I have discussed about the history of this Language.

So now, I will directly jump to my original topic, where, I am going to teach you two Important features of this Tool, which, you as a beginner, will like it the most 🙂
They are

i) Recording a Macro

ii) Playing a Recorded Macro

Where do you find or see excel Macro or VBA code in Excel?

Don’t get confused with these two terms which I am using Macro and VBA. It is not worth spending time on. You can consider them to be the SAME THING for now. You can refer my video tutorial,, if you really want to know the difference between these two terms.
In this tutorial, I will be taking example of MS Excel and will be exploring each and every possible technique to do the things in a very easy manner.

In MS Excel, we have both recording and writing our own macros based on our need. We will start with Macro recording.

How to Record Macro in excel

In this section you will learn, how to Record Macro in Excel. Follow the below Steps one by one to record macros in Excel:

STEP 1.

Open one excel workbook. (Taken example of MS Excel 2010)

STEP 2.

Go to “Developer” Tab of the workbook. (How to add Developer Tab in Excel-2010 and 2007 Workbook)

STEP 3.

Click on “Record Macro” button in the right hand side of the Top Menu Bar


STEP 4.

In Excel 2007 and 2010, Macro recording can be started by clicking on the Red Shape button marked in the bottom bar of the Excel in left hand side.

STEP 5.

Click on Record Macro Button shown above

STEP 6.

In the above dialog box, enter the suitable name for this Macro.
You can also specify the shortcut key for running this particular recorded macro. It means on pressing that particular shortcut-key, this macro will automatically run.
To know more about assigning short keys to your macros read this article: How to assign a Shortcut key to a Macro ?
You can also refer list of important built-in short keys in Excel here

STEP 7.

You can give the location, where you want to store this particular macro and also you can write some description about this particular to be recorded Macro.

STEP 8.

Now click OK and do some operation on the excel sheet. Like formatting of the cell or sorting some of the values etc. and click on the Stop button at the same place when you started running the Macro.


STEP 9.

I have done the above formatting and wrote few column names while recording.

STEP 10.

To view this particular recorded macro, right click on any of the Sheet Name -> View Code

STEP 11.

In left hand side pane, under VBA Project of that workbook, Expand the Module

STEP 12.

One Module would have been created there “Module 1”. Click on this

STEP 13.

You can see the recorded code with the given Macro Name.

How to Run Excel Macro or VBA code in Excel

You can Run this Recorded Macro in two ways:

1. By Pressing Run Button

2. By Pressing a short key – Alt+F8

Before, I run this recorded Macro, I have deleted the formatting done during the recording of this macro. Now once I will run this Macro, then automatically that formatting will be done in that Sheet.. Magic.. Isn’t it? 🙂 First, we will see how to run the recorded Macro by pressing the play button in VB Editor screen.

Here is the clean sheet :
 

Few Amazing Excel Tools & Add-ins – FREE Download

With over 10,000+ readers and counting Join NOW and get a FREE E-book to download !!

DOWNLOAD FREE E-BOOK

How to Run your macro by pressing Play button?

STEP 1.

First of all go to your VBA code screen. You would not find play button on the workbook screen.

STEP 2.

Place your cursor/mouse within the excel macro which you want to run

STEP 3.

Click on Run or Play button as highlighted in below image:

simple-excel-macro

That is it !! You are done… and here is the result:

   

Important

If you do not place your cursor somewhere within the VBA code which you want to run, then it will show you below popup with list of all Macros written in your workbook for your select which one you would like to run.

simple-excel-macro

How to run play your macro without going to VBE Screen

If you Do not want to run the Macro, by Pressing the Run Button in VBE screen, not to worry, you can run it from your Worksheet screen as well. Follow the below 3 simple steps to run your macro without going to VBE screen.

STEP 1.

Press Alt + F8 as a Shortkey. Following popup will appear (same as mentioned above)
simple-excel-macro

STEP 2.

Select Your Macro from the Drop Down

STEP 3.

Click on Run

That is it!! Congratulations !! Now, you know how to Record and Play Macro in Excel Workbook.

cover3d_0-89071700_1484285537__1_

Join over 10, 000+ Excel VBA Enthusiasts & get this FREE e-Book Now!