「Excel VBA」if文にネストの構造のサンプル
書式
If 条件式1 Then
If 条件式2 Then
If 条件式1 Then
If 条件式2 Then
If 条件式1 Then If 条件式2 Then
使用例
Sub sampleFunc()
Dim xx,yy As Integer
xx = 67
yy = 78
If xx = 67 Then
If yy = 78 Then
Debug.Print "nest sample"
End If
End If
End Sub
Sub sampleFunc()
Dim xx,yy As Integer
xx = 67
yy = 78
If xx = 67 Then
If yy = 78 Then
Debug.Print "nest sample"
End If
End If
End Sub
Sub sampleFunc() Dim xx,yy As Integer xx = 67 yy = 78 If xx = 67 Then If yy = 78 Then Debug.Print "nest sample" End If End If End Sub