Skip to main content
Visual Basic for Applications (VBA) is a subset of the Visual Basic Programming language for use with Microsoft Word, Excel, Access etc. While it contains many features not supported by VBScript (another subset of VB), the basic syntax, or construction of the language, is very similar.

Variables

A variable is a virtual container in the computer’s memory that’s used to hold information. In concept, it is much the same as a notepad. You can jot down information on the page of a notepad and return to that specific page later to remember what you wrote or modify the information. A computer program can store information in a variable and then access that information later by referring to the variable’s name.

How do i create a variable?

When you create a variable, you have to give it a name. That way, when you need to find out what’s contained in the variable, you use its name to let the computer know which variable you are referring to. You have two ways to create a variable. For example, you want to create a variable called Quantity, you would enter:

Visual basic for applications features not in VBScript

Last modified on November 3, 2026