Vba Macro Introduction
Vba Macro Introduction
Excel VBA allows you to automate various activities you do in Excel. We use Excel to analyze
data, create reports, prepare charts & presentations, do calculations and understand information.
When we are doing all these, we spend quite some time, repeating same steps.
For example, we may prepare and email same type of report every week with different data.
By using Excel VBA, we can cut down the time we spend repeating these steps and improve our
productivity.
VBA stands for Visual Basic for Applications. Just like you and I have a language, computer
programs too have their own language. VBA happens to be the language in which Excel speaks. For
that matter, VBA is also the language of MS Word, PowerPoint, Access and other MS Office
applications.
For example the following line says hello to you:
MsgBox "hello"
Just like any language, VBA too has its own rules, grammatical structures & nuances. Once you
understand these, speaking VBA with Excel becomes as easy as chatting with your friend over a drink.
2. What is a Macro?
While VBA is the language which Excel speaks (and understands), Macro is like a paragraph. In other
words, a Macro is a set of instructions given to Excel to accomplish something.
For example, this is a macro for generating a report (written in plain English, not VBA)
1.
Open data.xls
2.
3.
4.
5.
6.
Email it to boss
When we execute or run this macro, we end up generating the report & mailing it.
3.How is it useful?
It lets you get the most out of your software investment (or, more likely, your employers
software investment). Using Excel without knowing VBA is sort of like buying a TV set and watching
only the odd-numbered channels.
It will improve your productivity and Save your time (eventually). Mastering VBA definitely
takes some time, but youll more than make up for this in the amount of time you ultimately save
because youre more productive. Sort of like what they told you about going to college.
It helps you to reduce the manual errors.
Visibility in the Company. Like it or not, Microsofts applications are extremely popular. You may
already know that all applications in Microsoft Office support VBA. The more you know about VBA, the
better your chances for advancement in your job.
Its fun (well, sometimes). Some people really enjoy making Excel do things that are otherwise
impossible. By the time you finish this training, you just might be one of those people.
Since we dont know any VBA, we will use this recorder to record our actions and then we will see
recorded instructions (called as code in computer lingo) to understand how VBA looks like.
Step 1: Select any cell & start macro recorder
This is the easiest part. Just select any cell and go to Developer Ribbon & click on Record Macro
button.