The VBA Loop For Each

This is an excellent loop and the macro recorder never records this type of loop. VBA is an object-oriented language. It's common to have a collection of objects in Excel, such as a collection of worksheets in a workbook, cells in a range, PivotTables on a worksheet, or data series on a chart.

This special type of loop is great for looping through all the items in the collection. Before discussing this loop in detail, you need to understand a special kind of variable called object variables.

0 0

Post a comment