Learn VBA Part 24 – Do While Loop in VBA Hindi
Use the Do Until Loop in Excel VBA. Code placed between Do Until and Loop will be repeated until the part after Do Until is true
The Do Until loop is very similar to the Do While loop.
The loop repeatedly executes a section of code until a specified condition evaluates to True.
In The Do While loop, you may on some occasions want to enter the loop at least once, regardless of the initial condition
here are 2 ways a Do While loop can be used in Excel VBA Macro code.
You can tell Excel to check the condition before entering the loop, or tell Excel to enter the loop and then check the condition. To stop an endless loop, press ESC or CTRL+BREAK.
To force an exit from a Do Until loop you use the line: Exit Do, e.g. If lNum = 7 Then Exit Do
Looping is one of the most powerful programming techniques. A loop in Excel VBA enables you to loop through a range of cells with just a few codes lines