Do loop without condition

The loop does not require a running variable. The loop is looped until it is exited with Exit Do.

The loop can be continued immediately with the Continue command.

 

Dim i As Long, k As Long

i := 0

Do

   k := k + 100

   If k > 1000 Then

      Exit Do

   End If

   i := i + 1

End Do

Caution: If no cancellation condition is specified, this loop can cause the application to hang.