How to use Nested If-else statement in VBA?

An If or ElseIf statement inside another If or ElseIf statement(s). The inner If statements are executed based on the outermost If statements. This enables VBScript to handle complex conditions with ease.

Syntax:

Following is the syntax of a Nested If statement in VBScript.

If(boolean_expression) Then 
Statement 1 
..... 
..... 
Statement n 
If(boolean_expression) Then 
Statement 1 
..... 
..... 
Statement n 
ElseIf (boolean_expression) Then 
Statement 1 
..... 
.... 
Statement n 
Else 
Statement 1 
..... 
.... 
Statement n 
End If 
Else 
Statement 1 
..... 
.... 
Statement n 
End If