VBA allows us to: · Automate repetitive tasks – Ex. Creating daily charts · Enforce standards on tasks – Ex. Making sure journal entries balance before posting · Simplify complex tasks – Ex. Creating user defined functions to replace long, convoluted formulas · Perform tasks that would be otherwise impossible – Ex. Posting data to external databases
What is VBA?
VBA stands for Visual Basic for Applications. VBA is known as the “Macro” language for Microsoft’s (and others’)
Office applications (aka “Host Applications”). Even though VBA is found in many different applications (Excel, Outlook, Access, Word, Visio, and others), the things that make up this computer language such as Functions, Variable Types, Operators, and Branching and Looping are the same in all of them:
Functions Just like Excel, VBA has a rich functions library. Some are exclusive to VBA. Many are
similar to Excel. For example, Excel’s Absolute Value function is ABS(). So is VBA’s. Variable Types Variables are like Excel’s cells – they hold values that can be read or changed. Unlike Excel’s cells, variables must be of certain types that determine what the variable can hold. Two common variable types are:
Integer Holds small whole numbers for use in math operations String Holds anything you can type but won’t use in math operations.
Branching and Looping This differentiates Excel from a procedural language like VBA. Branching and looping are why VBA is a strong complement to Excel. The procedural elements of VBA are: If/Then/Else Statements Used to conditionally run specific sections of VBA code Select Case statements Similar to If/Then/Else, Select Case statements run specific sections of VBA code based on an a single expression that can have multiple values.
As you can see, VBA is similar is some respects to Excel, so leaning VBA isn’t that difficult for Excel’s users. And once you’ve leaned VBA, you can use it to add automation to many different applications without having to learn different languages.