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.
Loop through Worksheets –
Sub LoopthroughinWorksheets() Dim i As Integer Dim wsh As Worksheet For Each wsh In ThisWorkbook.Worksheets MsgBox wsh.Name Next 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 Next End Sub