Does VBA Have a Ternary Operator? September 7, 2023 by Tarik Sub test() Dim x As Long Dim y As Long y = 1 x = IIf(y = 1, 1, 2) End Sub