How to Create a Simple Macro in Excel

by Joanna on February 23, 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.

{ 2 trackbacks }

How to Edit a Macro Using Microsoft Visual Basic in Excel
October 26, 2009 at 6:49 pm
How to Create a Toolbar Button for an Existing Macro
October 26, 2009 at 6:55 pm

{ 131 comments… read them below or add one }

Jyoti March 7, 2007 at 12:28 pm

Good demostration with figures and comments. Easy to unsersatnd.

Ahmad Hidayat March 14, 2007 at 1:41 pm

Magnificent,

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

Thanks then.

Hrishikesh March 15, 2007 at 2:43 am

Realy easy to understand. Looking froward to more such articles

Yann Souvorak March 15, 2007 at 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

Mahamood March 18, 2007 at 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.

Tigran March 28, 2007 at 1:04 am

SIMPLE, CLEAR AND HELPFUL. THANK YOU!

priya March 29, 2007 at 10:15 am

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

Devdeep Dahiya March 29, 2007 at 6:13 pm

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

freddy April 9, 2007 at 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

Nana April 10, 2007 at 9:19 pm

thanks a lot

simple n easy to understand for beginners

Muhammad Umar Farooq April 12, 2007 at 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

Harish April 17, 2007 at 11:51 am

GOOD ONE FOR BEGINNERS.THANKS A LOT.

Sareesh April 17, 2007 at 12:53 pm

It is really wonderful and helps to understand easily

Kaylarean April 27, 2007 at 7:47 pm

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

Mansurul Haque May 3, 2007 at 6:27 pm

Greate Help :)

amit May 29, 2007 at 4:23 pm

after this, macro no more sounds threatening !!!

Kesh June 13, 2007 at 12:40 am

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

Arafath June 17, 2007 at 1:36 pm

Its very good simplest example

Satya June 28, 2007 at 2:19 pm

Good Example. Very simple explanation

Neelam July 25, 2008 at 9:55 pm

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

meenakshi July 31, 2008 at 11:12 am

Good Tutorial for begginers as it have clear discription with images

Rafeek August 5, 2008 at 11:46 am

it is good …

gohar August 6, 2008 at 12:25 pm

very good demonstration.
very basics idea of macros.

Shyl August 12, 2008 at 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.

Chinnu August 18, 2008 at 5:14 pm

very nice demonstration and easy to understand

S.K.Singh August 21, 2008 at 9:02 am

Very good exlanation with a suitable example.

Nidhi August 28, 2008 at 1:08 pm

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

Sagar Bajpai September 2, 2008 at 1:45 pm

Very good exlanation with a suitable example.

Nishant September 4, 2008 at 8:09 am

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

Thanks a ton.

Chain Singh September 5, 2008 at 3:50 pm

Its really good explained and demostration.
Thanks

Ashish September 5, 2008 at 5:38 pm

Thanks

Henry September 9, 2008 at 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.

jayakumar September 10, 2008 at 1:47 pm

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

SAAI DEVAKUMAR September 13, 2008 at 11:17 am

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

NITIN JAIN September 16, 2008 at 2:35 pm

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

Nithiyaraj September 19, 2008 at 4:04 pm

looking good

Hemant October 25, 2008 at 4:05 pm

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

Srinivas October 29, 2008 at 6:32 pm

Good easy to understand

Shalini November 4, 2008 at 4:21 pm

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

Abhijt November 8, 2008 at 2:43 pm

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

Hitesh Parmar November 10, 2008 at 4:34 pm

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

chandru November 11, 2008 at 3:44 am

very good demonstration.Keep posting more samples

viplove November 11, 2008 at 6:09 pm

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

Debashis November 13, 2008 at 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

RAJESH KAMCHERLA November 18, 2008 at 9:55 pm

Hi,

This is really helpful for the biginers. Its a nice example for simple macors.

Thanks,
Rajesh

nikki December 11, 2008 at 11:47 am

could you pls post the codes that is needed for programming a macro

i need it for my project

and
if its okay to you, pls send me the copy thanks in advance

Nagesh December 29, 2008 at 7:25 pm

Good work

Sonali January 6, 2009 at 1:39 pm

Wowwww its so simple. Today I wrote my first Macro and I am sure I will be able to learn to write even complex Macros too. Thanks very much….:-))

Natasha January 16, 2009 at 10:24 pm

good illustration of creating a macro.

LOVE January 23, 2009 at 2:26 pm

hello all

it will b alrite to understand but plz make more comfort to perfectness as u what is perfection in any work.
best regards
love

Leave a Comment

Previous post: How to Easily use the Autofilter and Advanced Filter Functions in Excel

Next post: How to Create a Simple What If Scenario in Excel

Sitemap