What is Do Until Loop in VBA Excel?
In VBA Do Until Loop , we must define criteria following the until statement, which indicates when we want the loop to stop, and the end statement is the loop itself. So, if the condition is FALSE, the statement will continue to be executed within the loop, but if the condition is TRUE, the Do Until statement will be terminated immediately.
As the name implies, the Do until loop is used in almost all programming languages to perform some task until a criterion is met. We also use the Do until loop in VBA from time to time. The term "Do Until Loop" refers to doing something until the condition becomes TRUE. It is similar to a logical function that operates on the basis of TRUE or FALSE.
Syntax
Syntax 1
Do Until [condition]
[Perform Some Task]
Loop
Syntax 2
Do
[Perform Some Task]
Loop Until [condition]
Example Code
sub loopuntil()
dim i As Interger
i=1
do Until 1>6
Cells(i,1).Value=40
i=i+1
Loop
End Sub
Please Watching My Video is Below
No comments:
Post a Comment