Excel Macros – How To Build Excel Macros

Excel macros

Last week we took a look at what excel macros are, why using them makes so much sense and some of the ways they can be used. Today, we will look at how to create your first macro. It can be intimidating at first but it’s actually much easier than you could imagine. There are two different ways to create macros in excel. The more advanced one is of course to write the code directly, which is much more challenging when you are a beginner and we do not recommend starting off that way. The second way is to record your macro. What does that mean?

Recording a macro simply means executing a series of tasks and the macro will then do exactly the same thing.

Example: Imagine that a store that sells tennis items wishes to send a summary of the orders from the past month to their 4 clients. Here is the spreadsheet which includes all orders from that month, you can see it here and/or download the spreadsheet here.

In order to do that I will simply start recording by clicking on:

Then, I proceed, so I started by filtering the columns, by selecting them and then clicking on:

Then, I select client #1:

I then copy the columns, create a new spreadsheet and paste those columns. I then saved the file to: C:/client1.xls

I closed that file and did the same thing for the 3 other clients.

Once that was done, I simply “stopped the recording” by clicking on the “stop button”

The result is that I now have a macro that can reproduce those exact steps. If you want to either see it or start, you would simply go back to tools/macro and click on step into:

Here is the code that I see:

Please do not panic. I know that it looks much more complicated than you were hoping for. Believe me, it will get much easier. First off, it’s important to know that code written when recording macros looks much more complicated. Also, the goal is simply to learn a few lines of code every time, not to understand it all from day one.

You can download our spreadsheet here and try the macro for yourself, you will see how it works.

***************************************************

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"

DHIREN SHAH

superb, send more illustration for EXCEL



SEO agencies in Glendale

SEO agencies in Glendale

Excel Macros – How To Build Excel Macros | Experiments in Finance