「Excel VBA」Case ISで値を比較するサンプル

2021年2月20日

書式
Case Is 比較演算子
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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

 

Excel VBA

Posted by arkgame