Worksheets.Count

Chris6629

New Member
Joined
Sep 22, 2014
Messages
4
Hi All

I have a workbook with multiple worksheets. Some worksheets have charts based on other Data Worksheets.

I notice that ActiveWorkbook.Worksheets.Count does not include Chart worksheets.

Example: if total number to worksheets in my workbook is 15 (10 data and 5 charts), then ActiveWorkbook.Worksheets.Count gives 10.

How to count worksheets with charts

Thank you
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
13,336
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
Try ActiveWorkbook.Sheets.Count
 

Chris6629

New Member
Joined
Sep 22, 2014
Messages
4
Thx Mark
Got it, thank you very much, so there is a difference between Sheets.Count and Worksheets.Count
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,835
Office Version
  1. 365
Platform
  1. Windows
Chart sheets aren't worksheets, so they don't get included in Worksheets.Count.
 

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,855
Thx Mark
Got it, thank you very much, so there is a difference between Sheets.Count and Worksheets.Count

Hi Chris
Welcome to the board

The Sheets collection includes all types of sheets. There are 5 types of sheets: worksheets, chart sheets, and 3 other old types.

The Worksheets collections only includes the sheets of type worksheet.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,544
Messages
5,529,457
Members
409,879
Latest member
Aussie_Excel_Wanna_Be
Top