Select Case Statement

Executes one of the statement blocks in the case based on the test variable

Select Case testvar
    Case var1
        Statement Block
    Case var2
        Statement Block
    Case Else
        Statement Block
End Select

The syntax supported by the Select statement includes the To keyword, a coma delimited list and a constant or variable.

Select Case Number          ' Evaluate Number.
    Case 1 To 5             ' Number between 1 and 5, inclusive.
        
    ' The following is the only Case clause that evaluates to True.
    Case 6, 7, 8            ' Number between 6 and 8.
        
    Case 9 To 10            ' Number is 9 or 10.
        
    Case Else               ' Other values.
        
End Select
	

Related Topics:

If...Then...Else

More:

Example - Select Case Statement