「Excel VBA」IF文に論理演算子Orを使用するサンプル
書式
if (条件式1) Or (条件式2) Then
使用例
Sub ifandsample()
Dim x, y As Integer
x = 34
y = 56
If (x = 34) Or (y = 57) Then
Debug.Print "aaaa truel"
Else
Debug.Print "bbbb false"
End If
End Sub
Sub ifandsample()
Dim x, y As Integer
x = 34
y = 56
If (x = 34) Or (y = 57) Then
Debug.Print "aaaa truel"
Else
Debug.Print "bbbb false"
End If
End Sub
Sub ifandsample() Dim x, y As Integer x = 34 y = 56 If (x = 34) Or (y = 57) Then Debug.Print "aaaa truel" Else Debug.Print "bbbb false" End If End Sub