Excel Macros – How To Build Excel Macros Part II

Excel macros

Last week, we published a “how to” guide to building your first macro with the “record” function. The record function is by far the best way to get started because you do not need to know any code, it requires very little time and can be very effective in automating a process. That being said, more complex, efficient macros are usually coded directly instead of being recorded. It does take some time to become familiar with the code but one way to get there is simply to record a macro and start playing around with the macro.

Why Record First?

I think that starting with a blank page can be very challenging and personally, I found that the best way to learn was by doing 2 things:

-Recording macros and looking at the code, modifying it
-Looking at macros found on the web or build my friends to learn a few more lines of code

Obviously, once you start to get more familiar with coding, you will also be able to look on the web, there are thousands of good websites that give code examples or specific knowledge on excel vba coding.

Why Is It Called Excel VBA?

Recording macros is the very simple way to do it but honestly, you are much more limited in what you can actually do. I suggest that you start by opening the spreadsheet that we were looking at in the last post, click here to do that.

As we had showed you, you can see the code simply by pressing Alt+F11. Then, by selecting the module, you will be able to see the code as you can see below:

Understanding Excel VBA Code, One Line At A Time

Then, if you want learn how the code acts, simply put the code window next to the excel one.

Then, select any part of the code and press “F8”, you will see lines becoming yellow. Each time that you press F8, the yellow line command will be “executed”.

In this example, when I select the first line and “execute” it:

You can see the effect on the spreadsheet:

You can simply press F8 for the entire code, one line at a time. That will give you a better understanding of how the code reacts. Ideally, you can also make small modifications to help you test some things. I would just press for a few things.

#1-Save as often as possible: When testing, it’s very likely that you will screw up in some way. Save once in a while to avoid losing too much work.
#2-You can “restart” at any time simply by pressing “stop”

#3-If you want to skip to a specific step, simply click on the left of the line you want to skip to. When you will execute “play”, it will run the macro but stop once it reaches the break point that you specified.

Most important of all, be sure to ask any questions that you might have here, we’ll be more than happy to help!


Look Good at Work and Become Indispensable Become an Excel Pro and Impress Your Boss


2 Feedbacks on "Excel Macros – How To Build Excel Macros Part II"


i want to learn macro and i dont know about vba but i want to learn it step by step and how can i learn coding guide me


Hi there would you mind letting me know which hosting company you’re working with? I’ve loaded
your blog in 3 different internet browsers and I must say
this blog loads a lot quicker then most. Can you suggest a good internet hosting provider at a fair price?
Kudos, I appreciate it!