Do-While loop with condition on the loop head

The loop does not require a running variable. The loop is looped as long as the continuation condition is met. The condition is at the beginning of the loop, so the loop may never pass through.

The loop can be aborted prematurely with the Exit Do command.

The loop can be continued immediately with the Continue command.

 

Dim i As Long, k As Long

i := 0

Do While i < 100

   k := k + 100

   If k > 1000 Then

      Exit Do

   EndIf

   i := i + 1

End Do