if statement visual basic code example
Example 1: if else statement vb.net
'If statement
If [condition] Then
[action]
End If
'else if & else statement
If [condition] Then
[action]
ElseIf [another condition] Then
[action]
Else 'if none of the conditions are true then carry out the action
[action]
End If
Example 2: vba if else
If condition_1 Then
result_1
ElseIf condition_2 Then
result_2
...
ElseIf condition_n Then
result_n
Else
result_else
End If