VBA Syntaxs

Do_LoopThese types of loops should be used with caution and always make sure the loop can be terminated.
Do_untilThis is executed at least once because the condition is at the bottom.
Do_WhileYou can test the condition either at the top or the bottom of the loop.
This should be used in situations where the loop will be terminated when a logical condition applied.

Exit_DoProvides a way to exit a Do loop
This transfers control to the statement following the Loop statement.When an Exit Do statement is executed the loop ends immediately. Do - While Loops can contain one or more Exit Do statements.
Exit_ForThis provides a way to exit a For loop
It can only be used on a For - Next or For Each Loop
Exit For transfers control to the statement following the Next statement.
For_EachThis gives you access to all the elements in a collection object without knowing exactly how many elements are in the collection.
All elements in a Collection
For_NextThis should be applied when you preedict in advanced how many times you want to loop.
While_WendThere is also a While Loop although this is less popular than the Do Loop
This logic is identical to the Do-While loop.
There is no Exit While in VBA
[otw_shortcode_button href=”#GotoTop” size=”medium” icon_type=”general foundicon-up-arrow” icon_position=”left” shape=”square”]Go To Top[/otw_shortcode_button]