Excel Macro Tutorial : What is Excel Macro ?

October 11, 2011| Posted by : | Filled in New to Excel Macro ?

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

Related posts:

  1. Excel Macro Tutorial : Add Developer Tab in Excel – 2007 and 2010 In the Previous Article What is Excel Macro of Excel...

36 Responses to “Excel Macro Tutorial : What is Excel Macro ?”

    • Ajith says:

      Thanks,for your consideration,,that is very helpfull for me,becouse i haven’t eny idea about macro ,but after follow up this E-book,,it helped me,,,thanks lot ,,again…so,,if you have any new tutorials regarding macro please mail link…

  1. christilda nalatham says:

    Hi Vishwa,

    you have any book or CD or all these things. because i am a beginner and i need to work on Macros for 1 year.. But i dont no anything about it.. Can you please help me

  2. Marl Jins says:

    Hey, I have noticed that occasionally this site shows a 403 server error. I figured you would be keen to know. All the best

  3. Abhijit says:

    Very easy and useful. It helps me alot. Thanks.

  4. [...] while recording it.   Step 1.Launch Record Macro Dialog Box as show in the picture below. Click to know how to record a macro     Step 2. Enter your Shortcut Key which ever you like it in the Shortcut Key box as [...]

  5. Feni says:

    Hi.. U r doing a great job..I just want u to help me in inserting a photo/picture in my userform for each user..

  6. shalini says:

    It was reallly very helpful.

    Thanks for sharing.

  7. Hey its really cool website and really helpful for New People to learn Excel macro. I want to add your site on my amzingreviewz com . Please allow me to add u r site in my list

    thanks

    amazingreviewz team

  8. manthan thakkar says:

    kindly learn me more macro demo

  9. sandy says:

    my macro is not running it's shows the error…

  10. Jeena says:

    I have a master sheet which have information of 10 of my employee and their task status in detail.

    i need to run a macro which will identify these 10 employee and create new sheet as per there name.

    which i have done with my below code:

    ————————————————————

    Sub MAIN()

    Dim MyCell As Range, MyRange As Range

    Set MyRange = Sheets("Sheet1").Range("B2:B16")

    Set MyRange = Range(MyRange, MyRange.End(xlDown))

    For Each MyCell In MyRange

    Sheets.Add after:=Sheets(Sheets.Count) 'creates a new worksheet

    Sheets(Sheets.Count).Name = MyCell.Value ' renames the new worksheet

    Next MyCell

    End Sub

    ——————————————————————–

    now what i need to do is extra the rows with the employee name and put the row into the new sheet as per their name.

  11. sheta says:

    hai…i am a chemical engineer student..my lecturer give me assignment..where..user have to key in the x value..and the macro would provide the y value…its like an equation with x variable in it ..to give the y value to the user..can i know how to do it?? thanks..

  12. nagaraja says:

    hi I want to learn macro in excel kindly let me know how to work on macro

  13. Yogisha says:

    Hi Vishwa,

    This is Yogisha.M you are doing wonder full job thank you for your suggestion, and I need one Branch Dash Board template (including all Parameters). Please help me on this.

  14. Prabhu says:

    Hi Vishwa,

    I need to learn Excel macro cording,can you please help on this regards just give me small cordings with examples.I iknow recording I want to go to next step.

  15. Kumar says:

    I would like to set up a macro in a workbook which automatically saves/closes the workbook after a specific period of time.

    For example….if its idle for 5 mins without any activity it should give alert msg and close the excel file.

    The trick is, the macro should only run if there has been no activity/changes to the workbook in that period of time.

    If a workbook is accidently left open on a computer, this will close it automatically.

    I have been searching for info on how to do this, and need help. Any advice is appreciated.

    I am novice so step by step with programming will work for me…

  16. clinta says:

    chanceless vishwa helps me a lot as a new to excel i need to learn a lot need ur help:(

  17. Mahesh says:

    Hi Viswa,

    just like the above task i have to copy certain columns from a excel document and create a new excel document with help of a macro.Please help me with this

    Regards,

    Mahesh.N

  18. Yogesh says:

    good work man!!!!!!!

  19. Mahesh says:

    Hi Viswa,

    This is really amazing .I truely appreciate your work. i have just started learning excel and this is te first macro i ve ever tried. Thanks a lot . i would like to learn a lot.

    Thanks,

    Mahesh.N

    • Vishwamitra Mishra Vishwamitra Mishra says:

      Thanks Mahesh!!

      • Mahesh says:

        Hi Viswa,

        I am using a excel document currently and all i wanted to do is b running a macro ,it should create a new excel document with copying the values from the document that i currently have. please help me with this.

        • Vishwamitra Mishra Vishwamitra Mishra says:

          Hi Mahesh,
          If you are just trying to make a copy of the same workbook then use the following code: Let me know if this helps you.

          Sub Creat_Copy()
          Dim Wb As Workbook
          Set Wb = ThisWorkbook
          Wb.SaveCopyAs "E:LearnExcelMacro.comExcelFormattedhello.xls"
          End Sub

          • Mahesh says:

            HI Viswa,

            1.i just opened the document

            2.ALT+f11

            3.insert->module

            4.copied the script

            5.changed the file location and ran it.

            6.IT THOROWING A COMPILATION ERROR.

            Please bear with me since i am a bigginer i am not so good at this. please help me.

            Thanks.

          • Vishwamitra Mishra Vishwamitra Mishra says:

            What is the error?

          • Mahesh says:

            Hi Viswa,

            Thanks a lot, i correced the sntax error it worked fine …. hats off to you .. feeling great to reach you in case of any oter help. Please ignore the above two posts.

            Thanks

            Mahesh.N

          • Vishwamitra Mishra Vishwamitra Mishra says:

            Thanks Mahesh !!

  20. [...] Code Window in Visual Basic Editor of your Workbook and start writing your first macro.   1. What is Excel Macro ? 2. How to Record Macro / How to Run Macro 3. Add Developer Tab in Excel – 2007 and [...]

  21. [...] the Previous Article What is Excel Macro of Excel Macro Tutorial, you have read, what is Macro, How to Record Macro and How to Run [...]

  22. Shagun says:

    This is amazing Vishwa. You have given a detailed description step by step.

    I am a beginner and didn't even know what a macro is. I have created my first macro. Kudos to you!!!

    • Vishwamitra Mishra Vishwamitra Mishra says:

      You are Welcome Shagun and keep giving feedback :)
      Thanks,
      Vishwa

      • Johnny Wolfkill says:

        This is awesome. I just created my first Macro titled Macross :)

        I feel like I have been taught to fish in Excel!

        Your instructions are very thorough. The procedure worked on my first fly through!

        Keep this up! I will definitely be back for more!

Leave a Reply

Comments

comments