Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple cases

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
Question: can a case select statement contain multiple entries for one case, like so:

select case var1
case "red","orange",green
 
i went there could not understand how it relates to my question, this is what i would like to know if this is proper syntax for the case select statement:

select case var1
case "red","orange","green"
case Else
case "dirt"
end select

how is expressionlist-n performed?

like this: case "red","orange","green"
or like this: case "red,orange,green"

thanks
 
how is expressionlist-n performed?
As explained in the link I gave you:
A comma delimited list of one or more expressions.

Select Case var1
Case "red", "orange", "green"
MsgBox "red or orange or green"
Case "dirt"
MsgBox "dirt"
Case Else
MsgBox "Yet another case"
End Select

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Select Case gives better performance [than multiple if statements] if there are a lot of conditions, but the difference is minimal for just a few conditions.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top