Share this Page URL

A VBA Language Primer > Variables - Pg. 414

Example 18-2. Using the Line Continuation Character .ParagraphFormat.TabStops.Add Position:=InchesToPoints(1.15), _ Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces Comments Comments are documentation in your code. The more you comment, the better you -- and anybody else -- will understand your code later. Add a comment by prefacing a line of text with a single quote, or by typing a single quote and additional text after a statement, but on the same line. Anything following the quote is considered a comment and will not be executed (Example 18-3). Example 18-3. Commenting Your Code ' This is a comment that takes up an entire line. i = 3 ' This is a comment after a statement Variables A variable is a name that you define to hold a value. Variables can hold basic types of data like numbers, text values, or dates, as well as more complex, structured data. In order to use a variable, it must first be declared ; this associates a variable name with the chunk of memory that holds the variable's value. You usually declare a variable yourself, although VBA may declare a variable for you, as you'll see. Once declared, a variable's value can be changed; this is called assignment .