About this lesson
Using a For Each loop to cycle through each object in a collection such as each worksheet in a workbook's worksheets.
Download this lesson’s exercise file.Loops: Looping through collections with For Each x in y loops.xlsm
Loops: Looping through collections with For Each x in y loops
Looping through each item in a collection
When to use
When you wish to loop through each item within a collection of items (e.g. each worksheet within a workbook).
For Each loop syntax
For Each <object> In <collection>
Hints & tips
- Including the <object> in the Next line is optional, but recommended to make your code easier to read
Lesson notes are only available for subscribers.