I am trying to write an IF statement like this:
if var [is any of 1,4,5,6,12] then do stuff
But I don't know the syntax for this in VBA, other than:
if var=1 or var=4 or var=5...
which seems a bit clumsy. Is there a different way?
You can use a Select Case statement:
select case var
case 1,4,5,6,12
'do something
case else
'alternative
end select
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With