Activeworkbook.Charts.count=0

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,153
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I tried to loop through all the charts in a workbook without success.

On troubleshooting, I realized that Activeworkbook.Charts.count=0 even when there are charts in the workbook. Am certain am pointing to the right workbook too
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Are they chart sheets, or embedded charts? Charts.Count only refers to chart sheets.
 
Upvote 0
Are they chart sheets, or embedded charts? Charts.Count only refers to chart sheets.

They are not chart sheets, they are just chart objects on different worksheets

When I loop through the worksheets and thru the chart objects on each sheet, it seems to work but am wondering why I can't simply get a count of the "chartobjects" or charts in a workbook with that line
 
Upvote 0
Because that's not what it does.
 
Upvote 0
Loop the sheets and use the chartobjects.count for each one.
 
Upvote 0
Loop the sheets and use the chartobjects.count for each one.
Thanks. I did that already. Thought there was some way to avoid the Nested loops, doesn't appear so :)
 
Upvote 0
There shouldn't be a nested loop - you only need to loop the worksheets to count the chartobjects.
 
Upvote 0
There shouldn't be a nested loop - you only need to loop the worksheets to count the chartobjects.
I didn't post the complete scope of what I intend to do. I actually want to perform some actions on each chart, hence my last post. Say I want to edit all chart titles, I would have to loop through each worksheet and loop through the chartobjects on that sheet, that's what I meant, so its a nested loop case
 
Upvote 0
If the chart objects are on separate worksheets, you need to loop, that's just the hierarchy of the Excel object model. It's not a big deal.
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top