Chapter 7 Flashcards
When are apostrophes ignored as comment indicators in Excel VBA?
When they are contained within a set of quotation marks
(e.g. Msg = “Can’t continue”)
Quick way to convert a block of statements into comments
From the VBE:
View->Toolbars->Edit
Select group of statements and click the Comment Block button
The first character of a variable must be a _____.
letter
Does VBA distinguish between uppercase and lowercase letters in variables?
No
Cannot use these characters in a variable name
, $, %, &, !
spaces
periods
math operators
Letting VBA handle your data typing results in these two issues
slower execution
inefficient memory use
To get a slight performance increase use this instead of Integer for variable type
Long
What is the default data type?
Variant
What is the data type Variant?
changes type depending on what you do with it
Use this statement as the first statement in code to force declaration of all variables
Option Explicit
One benefit of using Option Explicit as first line
mis-spelled variables will be identified as not being typed
Press this after typing the first two or three characters of a variable or reserved word or function to get selection list or auto-completion
Ctrl+space bar
Example of dimensioning a variable
Dim YourName as String
Dim January_Inventory as Double
Dim RowNumber as Long
Dim X
(X is treated as a Variant)