jeudi 1 mars 2018

VBA nested "for" and "if"

I am doing nested if within loops, which is basically:

1:  For i = 1 To n
    If condition1 Then
2:     For j = 1 To m
           If condition2 Then
3:            For k = 1 To p
                  If condition3 Then
                     statement1
                  End If
              Next k
           End If
        Next j
    End If
    Next i

After statement1, I would like to Exit the loop 2 and 3 and go directly to 1.

However if I use Exit For this will only exit 3. If I put a line before 1, and then use GoTo to refer to it, it will not work either because the program has to start with 1.

Aucun commentaire:

Enregistrer un commentaire