「Excel VBA」Case ISで値を比較するサンプル
書式
Case Is 比較演算子
使用例
Sub sampleFunc()
Dim n As Integer
n = 123
Select Case n
Case Is = 123
Debug.Print "value is 123"
Case Is > 150
Debug.Print "150より大きい"
Case Else
Debug.Print "other value"
End Select
End Sub
Sub sampleFunc()
Dim n As Integer
n = 123
Select Case n
Case Is = 123
Debug.Print "value is 123"
Case Is > 150
Debug.Print "150より大きい"
Case Else
Debug.Print "other value"
End Select
End Sub
Sub sampleFunc() Dim n As Integer n = 123 Select Case n Case Is = 123 Debug.Print "value is 123" Case Is > 150 Debug.Print "150より大きい" Case Else Debug.Print "other value" End Select End Sub