PDA

View Full Version : Select Case with multiple dependencies



chris0702
03-03-2009, 10:37 AM
Hello!

I have a question concerning select case.
I wanted to do something like:
Select Case Testcase
Case is > Statement1 and is < Statement2
Some code...
Case is < Statement1 and is > Statement2
Some different code
Case else
else code
end Select
Unfortunately this is not working, so I wonder if there is something out there other than using a lot of IFs or nested Select Case?

Thanks
Chris

CreganTur
03-03-2009, 10:45 AM
Welcome to the forum- it's always good to have new members.

You can do what you want using Select Case, you just have to use the correct syntax.

If you want to see if your tested expression is between a range you use:
Select Case TestCase
Case 1 To 4
'number is in range 1 through 4
Case 5 to 10
'number is in range 5 through 10
End Select

If you want to see if your tested expression is greater than something you can use:
Select Case TestCase
Case Is > 10
'TestCase is greater than 10
End Select

HTH:thumb

chris0702
03-09-2009, 05:41 AM
Thanks for the reply! It worked out fine.

Chris