Search here for all the info you want in this Blog

Select..case


Select..case


Executes one of several groups of statements, depending on the value of an expression.

Syntax:

Select Case testexpression
   [Case expressionlist-n
      [statements-n]] . . .
   [Case Else expressionlist-n
      [elsestatements-n]]
End Select

Example:

x = 3

select case x

case 1
msgbox "one"
case 2
msgbox "two"
case 3
msgbox "three"
case 4
msgbox "four"
case 5
msgbox "five"
case else
msgbox "greater then 5 and less than 1"
end select

No comments:

Post a Comment