Loop Through Worksheets

Loop Through in Worksheets, Sheets & Chart in VBA

In this article, we have explained the difference between Chart Sheet and Worksheet in Excel. We have also explained how to loop through the Charts, Sheets and Worksheets.

The difference between Chart Sheets and Worksheets

A Worksheets are Sheets, but not all Sheets are Worksheets.  There are 2 types of Sheets:

Worksheet: The sheet with the grid-lines and cells.


Chart Sheet: The sheet which contains a single chart.

Chart Sheet
Chart Sheet

Loop through Worksheets –

Sub LoopthroughinWorksheets()

Dim i As Integer
Dim wsh As Worksheet

For Each wsh In ThisWorkbook.Worksheets
MsgBox wsh.Name

End Sub

Loop through Sheets –

Sub LoopthroughinSheets()

Dim i As Integer

For i = 1 To ThisWorkbook.Sheets.Count
MsgBox ThisWorkbook.Sheets(i).Name

Next i

End Sub

Loop through Chart Sheets–

Sub LoopThroughinChartsheets()

Dim cht As Chart

For Each cht In ThisWorkbook.Charts

MsgBox cht.Name

End Sub


Click here to download practice file-

Watch the step by step video tutorial:

My Name is PK. I am founder of PK-AnExcelExpert.com. I am a Microsoft Certified Professional. I have more than 12 years of experience in Data Visualization, Excel Automation and dashboard creation. Excel is my passion and I like to do always something innovative in Excel and share it with other people.