This statement conditionally executes a group of statements, depending on the value of an expression.
If condition Then statements [Else elsestatements ]
Or you can use the following block form syntax:
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements]] . . .
[Else
[elsestatements]]
End If
With the single-line syntax, it is possible to have multiple statements executed as the result of an If...Then decision. However, they must all be on the same line and separated by colons, as the following code example shows.
If A > 10 Then A = A + 1 : B = B + A : C = C + B
If anything other than a comment appears after Then on the same line, the statement is treated as a single-line If statement.
A block If statement must be the first statement on a line. The block If must end with an End If statement.