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 ?

Macro is really great tool. 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.

Where do you find Macro?

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. 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:

1. Open one excel workbook. (Taken example of MS Excel 2010)
2. Go to “Developer” Tab of the workbook. (How to add Developer Tab in Excel-2010 and 2007 Workbook)
3. Click on “Record Macro” button in the right hand side of the Top Menu Bar



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.



5. Click on Record Macro Button shown above



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.

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.

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.



9. I have done the above formatting and wrote few column names while recording.
10. To view this particular recorded macro, right click on any of the Sheet Name -> View Code
11. In left hand side pane, under VBA Project of that workbook, Expand the Module
12. One Module would have been created there “Module 1”. Click on this
13. You can see the recorded code with the given Macro Name.

How to Run Macro in Excel

You can Run this Recorded Macro in two ways: 1. By Pressing Run Button 2. By Pressing Alt+F8

14. To run this 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. 

 

15.Now Click on the Run Button to Run the Written Macro.

simple-excel-macro

16.Click on Run

simple-excel-macro

17.After running the Macro, See the Result.

   

If you Do not want to run the Macro, by Pressing the Run Button in VBE, then follow the below Steps:

1. Press Alt + F8
2. Select Your Macro from the Drop Down
3. Click on Run

 
To Check out more Excel Macro Tutorials, visit Excel Macro Tutorial