PDA

View Full Version : Solved: Limit of Case select?



Aussiebear
11-19-2006, 04:02 AM
In an earlier post (VBA If Module) John kindly suggested that one method to be used was with using a multiple "case" in a Case Select argument. Is there a limit to the number of "Case" arguments and, can "Case type arguments be nested?

For Example, if you had a number of fruit or veges as the initial case select, could you then nest a secondary case argument, as in to determine the volume of fruit being sold ( Carton, 1/2 Carton, bunch, kilo, dozen)?

Ted

Andy Pope
11-19-2006, 04:46 AM
Yes you can nest them

Select Case Fruit
Case "Apple"
Select Case Package
Case "Single"
Case "Carton"
Case "Kilo"
End Select
Case "Banana"
Select Case Package
Case "Single"
Case "Bunch"
Case "Box"
End Select
End Select

But it is only worth nesting if the inner case test are different from each other.

Aussiebear
11-20-2006, 06:54 AM
Thank you Andy.