Dim Number, Digits, MyString Number = 53 ' Initialize variable.If
Number < 10Then
Digits = 1ElseIf
Number < 100Then
' Condition evaluates to True so the next statement is executed. Digits = 2Else
Digits = 3End If
' Assign a value using the single-line form of syntax.If
Digits = 1Then
MyString = "One"Else
MyString = "More than one"
Use If TypeOf construct to determine whether the Control passed into a procedure is a text box.
Sub ControlProcessor(MyControl As Control)If
TypeOf
MyControlIs
CommandButtonThen
Debug.Print "You passed in a " & TypeName(MyControl)ElseIf
TypeOf
MyControlIs
CheckBoxThen
Debug.Print "You passed in a " & TypeName(MyControl)ElseIf
TypeOf
MyControlIs
TextBoxThen
Debug.Print "You passed in a " & TypeName(MyControl)End If
End Sub