Free VBA Course: Loops (While loops, Do loops, For loops, exit a loop). Loops make it possible to repeat instructions a number of times, which can save a lot.
I would like to exit my
for
loop when a condition inside is met. How could I exit my for
loop when the if
condition has been met? I think some kind of exit at the end of my if
statement, but don't know how that would work.CustomXCustomX
2 Answers
To exit your loop early you can use
Exit For
If [condition] Then Exit For
DanDan
Another way to exit a For loop early is by changing the loop counter:
paul bicapaul bica