Dear professionals,
I have a for-loop in which under certain conditions it should skip part of the code and jump to the next increment (Next i). e.g.:
For i = 1 To 3
If i= 2 Then Goto JUMP
Msgbox(i)
JUMP:
Next
A long as the if-condition (i = 2) is not met it works but if i=2 then it goes to JUMP but on reaching "Next" provides a runtime error "syntax error".
Can anyone help me how this can be made. I also tried "if i=2 Then Next i" but this leads to an error upon compilation.
Regards miklquick
I have a for-loop in which under certain conditions it should skip part of the code and jump to the next increment (Next i). e.g.:
For i = 1 To 3
If i= 2 Then Goto JUMP
Msgbox(i)
JUMP:
Next
A long as the if-condition (i = 2) is not met it works but if i=2 then it goes to JUMP but on reaching "Next" provides a runtime error "syntax error".
Can anyone help me how this can be made. I also tried "if i=2 Then Next i" but this leads to an error upon compilation.
Regards miklquick