Lesson#11 Control Code Execution and Conditional Execution of Statements Flashcards
What is the GoTo statement?
It allows your code to go to a specific statement.
What is the basic statement structure for a GoTo Statement?
GoTo Label
How do you distinguish between numeric and text tables in a procedure?
Text labels are followed by a :.
What two rules must labels follow in VBA code?
Begin at first character of line of code and cannot be indented.
How does the If…..Then statement work?
Executes a set of statements if a condition returns True.
What is the structure for a If….Then statement?
If Condition Then
Statements ToExecute
End If
How does the If…..Then…..ElseIf…..Else statement work?
Carries out several conditions and executes depending on condition that returns True.
What does the Else statement do in a If……Then…..ElseIf……Else statement do?
Executes if none of the above conditions are met.
How does a Select Case statement work?
Uses a test expression to decide which set of statements to execute.
What is the structure for a Select Case statement?
Select Case TestExpression Case Expression# StatementsCase1 Case Else ElseStatements End Select
What are the 3 steps executed in a Select Case statement? Select Case TestExpression Case Expression# StatementsCase1 Case Else ElseStatements End Select
- VBA matches TestExpression to each expression within the expression list.
- Once VBA finds a matching case, it executes all the corresponding statements.
- If TestExpression does not match a case, VBA executes Else statement.
How do you specify a group of several individual conditions or situations under a single case?
Using (,), the To or the Is keyword.