Do Until Loop- VBA

The Do Until Loop continues a block of code, while the specified condition are continues to be not met and evaluated to False , and stops when the condition turns True. The condition can be tested either at the start or at the end of the Loop.

Syntax


Do Until (condition)
   [statement 1]

   [Exit Do]

   [statement n]
Loop   

How it works


Example of do while loop

Sub do_Until_ex()
  i =10
   Do  until i < 15
      Debug.Print "The value of i is : " & i
   i = i + 1
   Loop
End Sub

Result


The value of i is : 11

The value of i is : 12

The value of i is : 13

The value of i is : 14

The value of i is : 15

The value of i is : 16

Post a Comment

0 Comments