Chapter 21. Introduction to VBA

Visual Basic for Applications (VBA) is a programming language that is built into Excel and other Microsoft Office applications. It is important for you to remember that VBA is a language and try to learn it the same way you learned your mother tongue—by imitating how others use it to say different things instead of by memorizing the rules of grammar, studying vocabulary lists, and so on. You will then be able to learn VBA faster with less work than if you try any of the other methods people use.

But what is a program and why do we need special languages to write programs?

A program is a recipe, that is, a set of step-by-step instructions that a computer can follow to do what you want done. These instructions have to be written in one of a group of specially designed languages, called programming languages, because computers do not understand and cannot follow instructions written in English or any of the other languages we generally use to communicate with one another. Since we have been using these languages for years, we do not realize that all of them are overly complex. For example, they all have huge vocabularies, and in all of them we can say the same thing in many different ways and use the same words, phrases, and so on, to mean different things in different contexts. These are the complexities that make a language like English so rich. These are the same complexities, however, that make it so difficult to design computers that can understand ...

Get Financial Analysis and Modeling Using Excel and VBA now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.