「Excel VBA」Toで範囲指定の値を比較するサンプル
書式
Case 数値A To 数値B
使用例
Sub sampleFunc() Dim nn As Integer nn = 33 Select Case nn Case 15 To 20 Debug.Print "5~20" Case 30 To 35 Debug.Print "20~25" ' Case Else Debug.Print "other value" End Select End Sub
Coding Changes the World
書式
Case 数値A To 数値B
使用例
Sub sampleFunc() Dim nn As Integer nn = 33 Select Case nn Case 15 To 20 Debug.Print "5~20" Case 30 To 35 Debug.Print "20~25" ' Case Else Debug.Print "other value" End Select End Sub