Syntax
| Select Case expr
[Case caseexpr[, ...]
statements]...
[Case Else
statements]
End Select
| ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description
| Select the appropriate case by comparing the expr with each of the caseexprs. Select the Case Else part if no caseexpr matches. (If the Case Else is omitted then skip the entire Select...End Select block.)
| ||||||||||||||||
See Also
| |||||||||||||||||
Example
| Sub Main
S = InputBox("Enter hello, goodbye, dinner or sleep:")
Select Case UCase(S)
Case "HELLO"
Debug.Print "come in"
Case "GOODBYE"
Debug.Print "see you later"
Case "DINNER"
Debug.Print "Please come in."
Debug.Print "Dinner will be ready soon."
Case "SLEEP"
Debug.Print "Sorry."
Debug.Print "We are full for the night"
Case Else
Debug.Print "What?"
End Select
End Sub
|