@ alansidman

IIf is in fact an XL-function. It's a sort of short version of If...Then...Else. It has 3 parts (expr,truepart,falsepart)
In the 1st you evaluate a certain expression, if true returns truepart, if false it returns falsepart.
F.e.
Code:
Sub tst()
    MsgBox IIf(1 < 2, "Yes", "No")
    MsgBox IIf(2 < 1, "Yes", "No")
End Sub