VBA Excel: IF THEN Statement
This conditional statement enables you to check one condition and on the basis of that then run one or multiple statements if the condition holds. If the IF…THEN statement closes in the same line, the END IF is not required else IF…THEN statement should close with END IF.



Example 1: The below program checks if in ‘Sheet1’, we have UK mentioned or not in the cell A2 and if UK is present, it will return London


IF THEN Statement in VBA1

Example 2: If the cell (C2) is greater than 4 lakh, then divide the value by 100 and return the value in B2 by using IF, THEN.


IF THEN Statement in VBA2

Pin It on Pinterest

Share This