Excel VBA Macros Tutorial for Beginners

Excel Macros or VBA Tutorial for Beginners (with Images)

This Introductory post/tutorial is for beginners who want to learn the basics of Excel Macros !

Before getting started with excel macros just two lines about Macros and VBA.

  • What is a Macro? – A macro is a series of VBA commands and functions to perform a task.
  • What is VBA?– VBA (Visual Basic for Applications) is a programming language that Microsoft Office (MS Excel, Word, Power Point, Access etc) applications uses.

An excel macro is a set of VBA commands and functions that automates the tasks you do in excel.

Set of VBA instructions = Macro = Automated task

The best part is you don’t have to know anything about VB or VBA to automate a task you do in excel or to create excel macros.

It is as simple as using a voice recorder in your mobile phone.

Click on start + record the task + click on stop = it’s done! Your macro is created!

Why don’t you try creating your first Excel Macro?

Let’s create a macro which fills Green color in your Excel cells.  Follow the below steps to create your first macro:

Step 1: Open a new Excel and go to the Developer tab then click on Record Macro from the Code section.

macro

Step2: As soon as you click on Record Macro a pop-up window appears requesting you the following:




Macro name    : GoGreen (Lets name our macro as GoGreen; Remember not to use any special characters or space.)

Shortcut key    : For now lets leave it as blank.

Store Macro in : This gives you three options to save the macro in; current work book, Personal
Macro Workbook or in New Workbook. Let’s select the current workbook ie.‘This Workbook’    

Description      : My first macro to fill Green color in cells. (A small description about the
macro you are creating.)

After filling the details click OK.

macro

As soon as you click OK, the Record Macro’s icon turns to a blue button and the same is visible at the bottom of the screen and that indicates macro has started recording; means from now what ever you do in excel will get recorded. This blue button is our Start and Stop button.(Even we can directly start recording macro by clicking this button rather than going to Developer tab and then Record Macro.)

macro

Step3: Go to Home tab and click on Fill Color and from the list of colors displayed click on Green.

macro

Step4: Click on Stop button (The Blue button mentioned above) to stop recording macro.

Now that you have recorded your first macro and you can run it by clicking Developer tab – Macros- Run OR Alt + F8 – Run. But wait a minute lets make it little more beautiful and convenient to use.
Go to Insert – Shapes and click on any shape which you like (I have selected Rectangle). Now your courser turns to a ‘ + ‘ shape that means you can draw a Rectangle in any part of your Excel.

macro

After you draw a Rectangle, right click on it and click on Edit Text and name your shape as GoGreen. And once again right click on the shape and then click on Assign Macro..from the drop-down list.

macro

After you click on Assign Macro, a pop-up window appears then select GoGreen from the Macro name filed and click OK.

macro

You have successfully created your first macro and assigned a button to run that macro, start filling green color by clicking the GoGreen button.

macro

Now that we have to learn how does this macro works. We will learn it from the next chapters. Before that two quick home works:

1. Open VBA editor and try to explore/understand the GoGreen Macro codings by yourself.(Developer tab – Macros – GoGreen – Edit)
2. Record another macro to NoFill the entire sheet and assign that macro to a different shape and name it as Clear all. So thatyou can keep playing with your macro; One to fill the color and another to clear the color.
You can download my free GoGreen Macro Workbook from the below link.

download free excel macros

Do you want to get Professional Online Excel Training Videos from a Microsoft Certified Professional? There are around 23 Beginner Excel Training and around 38 Advanced Excel Training videos including VBA/Macro training. Please Click here! or the image below to get your training videos.
excel macros

If Videos won’t excites you then this Fastest and Funniest way to learn Excel Formulas Ebook will definitely be the best choice for you! Click here to view more details

About Anson

I’m Anson, having versatile experience in Business Process Outsourcing, Finance & Accounting, Information Technology, Operational Excellence & Business Intelligence. I'm currently working in a MNC in Bangalore, India. Learning anything new has always been my passions and if its related to Business and Technology then, I love it. This website/blog is an outcome of my passion towards it and I have been blogging since 2012. Outside business and technology I’m a movie freak who spends hours together watching and learning Cinema.

16 Comments

  1. As a Newbie, I am always browsing online for articles that can benefit me. Thank you

  2. Excellent post at Introduction to Excel Macros |. I was checking constantly this blog and I’m impressed! Extremely useful information specially the last part 🙂 I care for such information a lot. I was looking for this certain info for a very long time. Thank you and best of luck.

  3. I simply want to mention I’m very new to blogs and really savored your web page. Probably I’m want to bookmark your blog post . You definitely come with fabulous article content. Appreciate it for revealing your blog.

  4. Found your article quite intriguing in truth. I really loved examining it and you simply make quite some great points. I’ll bookmark this web site with the long term! Relly good write-up.

  5. Found your short article quite interesting without a doubt. I really experienced reading through it and you also make fairly some very good factors. I’ll bookmark this web page for the potential! Relly excellent short article.

  6. I like this website very much so much excellent information.

  7. Merely wanna remark on few general things, The website design is perfect, the subject material is really superb : D.

  8. Great post, I conceive website owners should learn a lot from this weblog its rattling user genial . “Frisbeetarianism is the belief that when you die, your soul goes up on the roof and gets stuck.” by George Carlin.

  9. Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your webpage? My website is in the exact same area of interest as yours and my users would certainly benefit from a lot of the information you provide here. Please let me know if this alright with you. Thanks a lot!

  10. Pingback: Introduction to Excel Macros | asKeygeek | Sco...

  11. Pingback: Robotic Process Automation (RPA) – What Why How All you need to Know

  12. Pingback: Strikethrough in excel and Count Strikethrough Cells

Leave a Reply