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.

{ 72 comments… read them below or add one }

Ajay January 23, 2009 at 4:41 pm

Nice example.

Paul O. Sanchez January 29, 2009 at 4:17 am

I will donate. Please show me how to create a macro that will automatically sort a column. This column will be set up as a vloopup from anothe worksheet. Is that possible? Need your help ASAP. I will pay you.

Ashish Sawant January 29, 2009 at 10:52 am

Hi,

I thought Creating Macro itself is tidious task but bigining is very simple like to go indepth of it
Thank you very much

Kumar January 29, 2009 at 5:30 pm

Quite understandable and easy to learn. In short very helpful..

neesha February 2, 2009 at 4:36 pm

this is very helpful for beginners

it would be great help if u can give some more examples.

Charles February 7, 2009 at 5:29 am

I’ve been using excel for a while, but somehow have never learned how to make a macro. That was the easiest explination i found anywhere. Thanks

Sanjay February 25, 2009 at 5:02 pm

Really simple!!!!

Arindam March 17, 2009 at 7:05 pm

Thanks.It would be nice if you can tell us how to create simple macros using VBA along with the syntax for simple VBA commands.

Rahul March 20, 2009 at 11:19 am

Thanks, this is great.

muthu March 30, 2009 at 12:04 am

hi,

it was very good and clear to understand

Chris April 2, 2009 at 7:49 pm

teach some complex example task dude….

rupali April 3, 2009 at 4:47 pm

good

TheOperative April 8, 2009 at 12:16 am

There are many more example on the way, I am in the process of upgrading the site.

TheTrainer April 23, 2009 at 12:44 pm

great job…

pandurang May 10, 2009 at 3:04 pm

very nice example i want to practice more than this .

manjunath May 12, 2009 at 6:49 pm

thanks dude ………..

please tell me web sites of other tutorial……..

MANJU

rashmi May 15, 2009 at 5:06 pm

hi,

i wants to learn macro..i can create a little bit but how to use it for whole sheet

Vayu May 28, 2009 at 5:09 pm

Excellent example to undestand about marco..thanks

Vayu May 28, 2009 at 5:37 pm

Excellent

Shrikant May 29, 2009 at 1:46 pm

Very good example!! :)

Sasikala June 2, 2009 at 5:01 pm

really it helps me. i got it i got it……..Thanks

parameswaran June 10, 2009 at 5:35 pm

good, very easy learn.
requesting you to give more on macro

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