The If…Then statement is used to evaluate whether a condition is True or False.
You can use If…Then block to execute one or more statements conditionally.
If <condition> Then
[else statements] End If
if a>5 Then a=a+10
Here condition is that ‘a’ should be greater than 5 and if it is true then ‘a’ should be incremented by 10.
<condition>:-The condition is usually a comparison, but it can be any expression that evaluates to a numeric value.
1.A single line of If…Then does not use End If statement.
If condition Then statement.
But if you use this in more than one line ,then syntax will be If…Then…End If.
2.If anything other than a comment appears after Then on the same line, the statement is treated as a single line If statement.
3.A block If statement must be the first statement on a line. The block If must end with an End If statement.
4.When a If condition is tested ,then If condition is True, the statements following Then are executed,otherwise not.