List of possible values

gebli

Registered User.
Local time
Today, 20:00
Joined
Oct 3, 2008
Messages
14
Hi,

I think this is pretty easy but I just can't find it...
Is there a way to check if a variable has one of several possible values?
I know I can use a CASE statement but I'm looking for a simpler method. Something like:

IF variable1 IN (value1, value2, value3) THEN
true
else
false
end if

Thanks in advance,

Gerry
 
Unfortunately VBA does not support your suggested syntax so its either use Case statements or
If A=1 or A=2 or A= 3 then
true
else
false
Endif
 
Hi,

I think this is pretty easy but I just can't find it...
Is there a way to check if a variable has one of several possible values?
I know I can use a CASE statement but I'm looking for a simpler method. Something like:

IF variable1 IN (value1, value2, value3) THEN
true
else
false
end if

Thanks in advance,

Gerry

How's that simpler than a case statement:

Code:
Select Case variable1

Case value1, value2, value3
   ...do whatever
Case Else
  False
End Select
Looks as simple to me
 
Thanks! Great news... My fault for not paying attention to an alternate syntax of the case statement!!

Gerry

PS: edited a previous reply... Boblarson's response came in while in edit mode!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom