How to Create a Simple Macro in Excel

February 23rd, 2007

All jobs and fields require some repetitive steps. Even the most creative jobs can usually require some monotonous tasks. Tools like Excel can help us automate some of those repetitive steps and that way makes our lives easier, so we can get the work done quickly and have more leisure time. In essence that is what Macros do; they’re shortcuts for repetitive tasks done within Excel. In this tutorial, I will show you how to create a simple macro that will memorize the steps involved in a simple repetitive task. We are going to be using fictitious information for the Training Department in a restaurant chain company called Happy Tummies. This company has restaurants in five major cities, so a great deal of training is done all year round. All restaurants are assigned a Training Manager – there are five Training Mangers in total. We’ll pretend you are the Training Specialist who works out of the Corporate Office located in Miami, FL and are responsible for analyzing and preparing reports on all the trainings completed. One repetitive task that you always perform is entering the names of all the Training Managers to prepare the daily training reports.

Let’s Get Started!

1. Go to Start>Programs>Microsoft office>Microsoft Excel to open the application. Then, go to Start>New to open a new spreadsheet. Go to File>Save as and save the new file before going further so you don’t loose any work.

macro screenshot 1

Please Note: Macros require you to set a security level of low, medium or high. For the purposes of this tutorial, which is just to show you the simple basic steps to creating a macro, we are going to set the security level to medium since a security level of high will restrict the use of the macro.

2. Go to Tools>Macro>Security, and a pop up window named “Security” will appear. Select the Medium option under the Security Level tab and click OK to continue.

macro screenshot 2

3. Go to Tools>Macro>Record New Macro.

macro screenshot 3

4. A pop up window named “Record Macro” will appear. Here you will n
need to enter a name for the macro under “Macro Name” – I’m calling this macro “ht” (the initials of the company, Happy Tummies). Please note that the first character of the macro name should be a letter, then you can use any letter, number or underscore but with no spaces. Then, enter a symbol from the keyboard under “shortcut key” to be used as a shortcut to activate the macro – I’m entering “h” since it is the initial of the company’s name. Then, you need to select the placement of the macro under “Store macro in:” – I’m saving this macro in the “Personal Macro Workbook” so that it is available when you create new spreadsheets and want to use the macro. Finally, enter a brief description of the macro under “Description” and click OK to continue.

macro screenshot 4

5. In this step, you will record the macro. You will see a tiny pop up window that will appear with a blue button – you can press this blue button at any time to stop recording the steps for the macro. Now, enter the five names of the training managers starting under column A, row 1 – The names are: Mary Smith, Thomas Spicler, Morgan Lopez, Samantha Davies and Nike Temples. Once you are done entering all five names, click the blue button to stop recording the new macro. You are done recording the macro, but please remember that they keyboard shortcut for this macro is Control Key + h, and that you saved the macro in your “personal macro workbook.”

macro screenshot 5

6. In this step will test that the “ht” macro works. Go to File>New to open a new spreadsheet. Then, press the Control key and “H” key at the same to activate the macro. You will see that the names of the five Training Managers have appeared under column A. Please note that you can also go to Tools>Macro>Macros and select this macro from the “Personal Macro Workbook” to run it.
macro screenshot 6

Well Done! You’ve learned some quick simple steps that will help you create macros. But, do keep in mind that macros can be more complex and powerful; so the more you learn about them and practice using them, the better you will get. I will you show more complex functionalities of macros in other separate tutorials.

If this tutorial has helped you, please consider donating.

44 Comments

  1. Comment by Jyoti on March 7, 2007 12:28 pm

    Good demostration with figures and comments. Easy to unsersatnd.

  2. Comment by Ahmad Hidayat on March 14, 2007 1:41 pm

    Magnificent,

    It works. Very Simple. Helpful.
    Before I think Macro is difficult, now very easy.

    Thanks then.

  3. Comment by Hrishikesh on March 15, 2007 2:43 am

    Realy easy to understand. Looking froward to more such articles

  4. Comment by Yann Souvorak on March 15, 2007 9:01 am

    I have a problem in Excel.
    I want to set up a chart which combines a pass word in botton, without protect sheet, it just press botton then the sheet could be used.

    Please, train me indetail.

    Hope to hear from you soon.

    Best regards,

    Vorak

  5. Comment by Mahamood on March 18, 2007 7:10 pm

    Its really very good site which helps us to learn more about Excel… I love excel i cannot stay without working on Excel I am very much thanks for developing the guys who develops the site.

  6. Comment by Tigran on March 28, 2007 1:04 am

    SIMPLE, CLEAR AND HELPFUL. THANK YOU!

  7. Comment by priya on March 29, 2007 10:15 am

    hi,
    the tutorial is framed well,so that even a child can understand.good

  8. Comment by Devdeep Dahiya on March 29, 2007 6:13 pm

    Great effort!! Good to see the pains that have been taken to make it user-friendly and easy-to-understand.

  9. Comment by freddy on April 9, 2007 11:32 pm

    its awesome i am totally new to excel
    and am learning it… learning this was very easy… a very clear and easy step by step procedure.. please continue doing such great stuff for people like us

  10. Comment by Nana on April 10, 2007 9:19 pm

    thanks a lot

    simple n easy to understand for beginners

  11. Comment by Muhammad Umar Farooq on April 12, 2007 11:37 am

    Terrific web site created by the web developer and the thinker who has the knowledge of Excel. I hope you will become sucessful in unpcoming events.

    Muhammad Umar Farooq

  12. Comment by Harish on April 17, 2007 11:51 am

    GOOD ONE FOR BEGINNERS.THANKS A LOT.

  13. Comment by Sareesh on April 17, 2007 12:53 pm

    It is really wonderful and helps to understand easily

  14. Comment by Kaylarean on April 27, 2007 7:47 pm

    Great, good for new beginners, easy to understand and well explained

  15. Comment by Mansurul Haque on May 3, 2007 6:27 pm

    Greate Help :)

  16. Comment by amit on May 29, 2007 4:23 pm

    after this, macro no more sounds threatening !!!

  17. Comment by Kesh on June 13, 2007 12:40 am

    Well, i dont think its good example. i need sometime more detail about macro. any idea?

  18. Comment by Arafath on June 17, 2007 1:36 pm

    Its very good simplest example

  19. Comment by Satya on June 28, 2007 2:19 pm

    Good Example. Very simple explanation

  20. Comment by Neelam on July 25, 2008 9:55 pm

    It is what we already know, can we have some better examples

  21. Comment by meenakshi on July 31, 2008 11:12 am

    Good Tutorial for begginers as it have clear discription with images

  22. Comment by Rafeek on August 5, 2008 11:46 am

    it is good …

  23. Comment by gohar on August 6, 2008 12:25 pm

    very good demonstration.
    very basics idea of macros.

  24. Comment by Shyl on August 12, 2008 11:33 pm

    Spoon Feeding. Wonderfull Explanation, it would be fine if u tell us how to edit the macros, if we need to add some more data in it.

  25. Comment by Chinnu on August 18, 2008 5:14 pm

    very nice demonstration and easy to understand

  26. Comment by S.K.Singh on August 21, 2008 9:02 am

    Very good exlanation with a suitable example.

  27. Comment by Nidhi on August 28, 2008 1:08 pm

    This was really helpful.So easy to learn and nicely explained.Very good for the beginners.Thanks.

  28. Comment by Sagar Bajpai on September 2, 2008 1:45 pm

    Very good exlanation with a suitable example.

  29. Comment by Nishant on September 4, 2008 8:09 am

    This is great for the beginners. Very well explained with pictures and descriptions.

    Thanks a ton.

  30. Comment by Chain Singh on September 5, 2008 3:50 pm

    Its really good explained and demostration.
    Thanks

  31. Comment by Ashish on September 5, 2008 5:38 pm

    Thanks

  32. Comment by Henry on September 9, 2008 6:38 am

    I’ve learned alot more since it is my first time to work with macros thanks alot, its alot more helpful for beginners.

  33. Comment by jayakumar on September 10, 2008 1:47 pm

    how to write the macro to delete the repeat number in ms-excel.kindly let me know

  34. Comment by SAAI DEVAKUMAR on September 13, 2008 11:17 am

    I WANT TO KNOW MORE ABT MACRO. THANK FOR YOUR TUTORIAL

  35. Comment by NITIN JAIN on September 16, 2008 2:35 pm

    very god explanation for making the macro
    but MORE EXAMPLE CAN BE TAKEN FOR FURTHER GOOD MACRO
    THANKS

  36. Comment by Nithiyaraj on September 19, 2008 4:04 pm

    looking good

  37. Comment by Hemant on October 25, 2008 4:05 pm

    well done,
    i like the way that u have given with demonstration of macro

  38. Comment by Srinivas on October 29, 2008 6:32 pm

    Good easy to understand

  39. Comment by Shalini on November 4, 2008 4:21 pm

    fantastic. :-) very good explanation and very useful. simple steps well done :-) thank you

  40. Comment by Abhijt on November 8, 2008 2:43 pm

    Very easy learning. How do I handle complex situations. Please guide.

  41. Comment by Hitesh Parmar on November 10, 2008 4:34 pm

    Nice & step wise detail is given to start simple macro. Thanks

  42. Comment by chandru on November 11, 2008 3:44 am

    very good demonstration.Keep posting more samples

  43. Comment by viplove on November 11, 2008 6:09 pm

    good article for beginners, simple language and good content. Thanks alot

  44. Comment by Debashis on November 13, 2008 5:25 pm

    Thanks Much, this is definitely good but then I need some more indepth knowledge on this. How could you help me?

    Warm regards,
    Debashis

Comments RSS TrackBack Identifier URI

Leave a comment