The loop requires a running variable. In the example below, the run variable i is initialized with a value of 0 and incremented by 1 each time the End For is reached. When the cancellation condition 100 is reached, the code continues after the End For.
The loop can be exited prematurely with the Exit For command.
The loop can be continued with the Continue command at the next index.
Example of a For loop that leaves prematurely when the condition is true:
Dim i As Long, k As Long
For i := 0 To 100
k += 100
Exit For If k >= 1000
End For
Example of a For loop that continues on the next index when the condition is true:
Dim i As Long
For i := 1 To 100
If (i Mod 2) Then
Continue
End If
End For