Case Logic structure:   Return to List

Select Case i' "i" is the expression (could also be a formula)
    Case 1' When the expression is equal to 1 or I could say greater than 3 (>3) or a similar evaluation
        V1$ = Selection.Text' This is what occurs
    Case 2
        V2$ = Selection.Text
    Case 3
        V3$ = Selection.Text
    Case 4, 5
        V4$ = Selection.Text
    Case 6 to 10
        V5$ = Selection.Text
    Case Else' The leftover situation
        V6$ = Selection.Text
End Select

    ' -- Another Example (using with an input box) --

intAge = InputBox("How old are you?")
Select Case intAge
    Case Is < 14
        msg = MsgBox("You can only ride a bike.")
    Case Is < 16
        msg = MsgBox("You can ride a motorcycle.")
    Case Else
        msg = MsgBox("You can drive a car")
End Select



Note to Webmaster