Skip to main content

Do Until

Again this is very similar to the Do While Loop we just used above in that it will check the condition BEFORE it enters the Loop. If the Value of iMyNumber is 0 (zero) when it reaches the Loop, the difference is the Do While would keep adding the number one to iMyNumber until it reached 1000.

 

In the Do Until it would never even enter the Loop because the condition MyNumber < 1000 has been met already ie; iMyNumber is 0 (zero).

 

 

Sub My_DoUntil()

Dim iMyNumber as Integer

 

Do until iMyNumber < 1000

iMyNumber=1+iMyNumber

    Loop

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *