Do - Until

This is executed at least once because the condition is at the bottom.

Do 
   statements
Loop Until boolean-expression

Do Until boolean-expression 
   statements
Loop

The following loop does not have any conditions associated with it and therefore would run indefinitely.
These types of loops should be used with caution and always make sure the loop can be terminated.

Do 
   Debug.Print icount
   icount = icount + 1
   If icount = 5 Then Exit Do
Loop

Nested Do - Until

When used within nested loops Exit Do transfers control to the loop that is one nested level above the loop where the Exit Do occurs.



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext