Eduard Florinescu
Eduard Florinescu

Reputation: 17531

How to iterate through multiples charts

I need to iterate and modify properties of some charts one by one, but for that I use ActiveChart ex.:

   Target_str = ActiveChart.SeriesCollection(2).DataLabels.Item(1).Caption
   Target = CDbl(Target_str)

To make my charts active I try to select them one by one:

    For i = 1 To ActiveWorkbook.Sheets(2).ChartObjects.Count
        ActiveWorkbook.Sheets(2).ChartObjects(i).Chart.Select
    '...
    Next i

But I get the following message in debug:

Run-time error '1004':
Unable to get the Select property of the Chart class

How can I make those charts active one by one, what am I doing wrong in the above code. Can I use other alternative?

Upvotes: 0

Views: 116

Answers (1)

user2480047
user2480047

Reputation:

What about this?

ActiveWorkbook.Sheets(2).ChartObjects(i).Select

Upvotes: 1

Related Questions