For...Each Variation : For Each « Language Basics « VBA / Excel / Access / Word






For...Each Variation

 
Sub WorksheetLoop2() 
    Dim ws As Worksheet 

    For Each ws In ThisWorkbook.Worksheets 
        Debug.Print ws.Name 
    Next 
End Sub 

 








Related examples in the same category

1.Using the For Each...Next Loop
2.Early Exit from a Loop
3.Using Nested Loops
4.Loop through ranges
5.Looping through the elements in an array