ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding Chart Series Problem (https://www.excelbanter.com/excel-programming/420297-finding-chart-series-problem.html)

WhytheQ

Finding Chart Series Problem
 
Good Morning,

I've got 50 charts on one sheet; each with a varying number of lines
on each chart.
Need to adjust all the series in one move. Thought I'd be able to have
a loop within a loop:

'===========================
Sub FindChartSeries()

Dim myChartObject As ChartObject
Dim mySeries As Series

For Each myChartObject In ActiveSheet.ChartObjects

myChartObject.Select

For Each mySeries In myChartObject.SeriesCollection
MsgBox "found series"
Next

Next myChartObject

End Sub
'===========================


Why is the above bugging out?
Any help much appreciated

Jason.


Andy Pope

Finding Chart Series Problem
 
Hi,

You need to include the Chart reference when using a ChartObject.

Sub FindChartSeries()

Dim myChartObject As ChartObject
Dim mySeries As Series

For Each myChartObject In ActiveSheet.ChartObjects
For Each mySeries In myChartObject.Chart.SeriesCollection
MsgBox "found series"
Next
Next myChartObject

End Sub

Cheers
Andy

WhytheQ wrote:
Good Morning,

I've got 50 charts on one sheet; each with a varying number of lines
on each chart.
Need to adjust all the series in one move. Thought I'd be able to have
a loop within a loop:

'===========================
Sub FindChartSeries()

Dim myChartObject As ChartObject
Dim mySeries As Series

For Each myChartObject In ActiveSheet.ChartObjects

myChartObject.Select

For Each mySeries In myChartObject.SeriesCollection
MsgBox "found series"
Next

Next myChartObject

End Sub
'===========================


Why is the above bugging out?
Any help much appreciated

Jason.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

WhytheQ

Finding Chart Series Problem
 
On 20 Nov, 10:49, Andy Pope wrote:
Hi,

You need to include the Chart reference when using a ChartObject.

Sub FindChartSeries()

Dim myChartObject As ChartObject
Dim mySeries As Series

For Each myChartObject In ActiveSheet.ChartObjects
* * *For Each mySeries In myChartObject.Chart.SeriesCollection
* * * * *MsgBox "found series"
* * *Next
Next myChartObject

End Sub

Cheers
Andy





WhytheQ wrote:
Good Morning,


I've got 50 charts on one sheet; each with a varying number of lines
on each chart.
Need to adjust all the series in one move. Thought I'd be able to have
a loop within a loop:


'===========================
Sub FindChartSeries()


Dim myChartObject As ChartObject
Dim mySeries As Series


For Each myChartObject In ActiveSheet.ChartObjects


* * * * * * myChartObject.Select


* * * * * * For Each mySeries In myChartObject.SeriesCollection
* * * * * * * * * MsgBox "found series"
* * * * * * Next


Next myChartObject


End Sub
'===========================


Why is the above bugging out?
Any help much appreciated


Jason.


--

Andy Pope, Microsoft MVP - Excelhttp://www.andypope.info- Hide quoted text -

- Show quoted text -


cheers Andy


All times are GMT +1. The time now is 10:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com