Select Case 文
なんかよく忘れるのでメモ
Select Case 値
Case 比較値1: 処理1
Case 比較値2: 処理2
...
Case Else: 処理x
End Select
以下、サンプル(あんまりいいコードじゃないが・・・)
Select Case val Case 0: ' 処理なし Case 1: MsgBox "睦月" Case 2: MsgBox "如月" Case 3: MsgBox "弥生" Case 4: MsgBox "卯月" Case 5: MsgBox "皐月" Case 6: MsgBox "水無月" Case 7: MsgBox "文月" Case 8: MsgBox "葉月" Case 9: MsgBox "長月" Case 10: MsgBox "神無月" Case 11: MsgBox "霜月" Case 12: MsgBox "師走" Case Else: ' 処理なし End Select
C言語の様に複数の比較値に対応した処理を一箇所に書けないので
そういう目的では If...Else...End If で処理しても変わらない。