Use IIF(conditional test, value for True, value for False)
Sub IIFSub()
Dim strMessage As String
Dim intNum As Integer
intNum = 12
strMessage = IIf(intNum > 10, "Number is greater than 10", "Number is less than 10")
Debug.Print strMessage
End Sub
Related examples in the same category