This statement repeats a block of statements while a condition is True or until a condition becomes True.
Do [{While | Until} condition]
[statements]
[Exit Do]
[statements]
Loop
Or you can use the following syntax:
Do
[statements]
[Exit Do]
[statements]
Loop [{While | Until} condition]
The Exit Do can be used only within a Do...Loop control structure to provide an alternate way to exit a Do...Loop. You can place any number of Exit Do statements anywhere in the Do...Loop. Exit Do often is used with the evaluation of some condition, such as If...Then. Exit Do transfers control to the statement immediately following the Loop.
When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one nested level above the loop where it occurs.