If
Previous Top Next

If can be used in two ways.
1.   One line: If Condition Then DoSomething [Else DoSomething]
Example: If TextBox1 > TextBox2 Then Msgbox ("Bigger") Else Msgbox ("Smaller")
Note: You can't use the line separator ':' between Then and Else.
2.   Multi line:
If Condition Then
            ...
Else If Condition Then
            ...
Else
            ...
End If

Example:
If TextBox1>TextBox2 Then
            Msgbox ("Bigger")
Else If TextBox1<TextBox2 Then
            Msgbox ("Smaller")
Else
            Msgbox ("Equal")
End If