Nested If-Then

A nested If-Then is used when you want to test a second condition based on the result of the first.

If (x = 5) Then

If (y = 15) Then

z = 25

Else

z = 0

End If

End If

This is NOT the same as:

If (x = 5) And (y = 15) Then

z = 25

Else

z = 0

End If

Nested If-Then code blocks can go many levels deep.  It's best to avoid too much nesting, as the code can become confusing.