Locked lesson.
About this lesson
Basic looping including counting iterations and exiting.
Exercise files
Download this lesson’s exercise file.
Loops: Basic Looping with Do Loops.xlsm21.4 KB
Quick reference
Loops: Basic looping with Do loops
Basic looping with Do loops.
When to use
To look at each item in a particular area, such as every row in a worksheet or every worksheet in a workbook
Instructions
A loop will continuously perform an action defined in the Do statement.
Syntax
Do
<Action>
If <test> = <result> Then
Exit Do
End If
Loop
Hints & tips
- Failing to include a status test with an "Exit Do" statement will result in a loop that just runs forever
- If you do end up in this situation, press CTRL + BRK to break into debug mode
Lesson notes are only available for subscribers.