「VBA入門」論理演算子Andを使うサンプル
構文
if(条件式1) And (条件式2) Then
サンプルコード
Sub testFunc()
Dim x, y As Integer
x = 21
y = 123
If (x = 123) And (y = 123) Then
Debug.Print "equal"
Else
Debug.Print "not equal"
End If
End Sub
Sub testFunc()
Dim x, y As Integer
x = 21
y = 123
If (x = 123) And (y = 123) Then
Debug.Print "equal"
Else
Debug.Print "not equal"
End If
End Sub
Sub testFunc() Dim x, y As Integer x = 21 y = 123 If (x = 123) And (y = 123) Then Debug.Print "equal" Else Debug.Print "not equal" End If End Sub
結果
not equal