ActiveChart.SeriesCollection(1).Points(3).Select ERROR

S

SpeeD72

Hi.

I need to apply the same color to the bars in a graph (via VBA),
wether the graph has 3 bars or 7 bars.

The problem that i face is that when the point (bar) doens´t exists
excel gives back an error:
ActiveChart.SeriesCollection(1).Points(3).Select in case of poínt 3
dont exists.

Is there a way to teste if the point exists, to only apply the
programing in that case?

Thanks a lot!!!

Jorge
 
J

JLGWhiz

Would something like:

ActiveChart.SeriesCollection(1).Points.Interior.ColorIndex = 3

Not work?
 
S

SpeeD72

Hi.
every bar has is how color. I can make every one with the same color.

Is there a way to teste if the point exists, to only apply the
programing in that case?

Thnks
Jorge
 
A

Andy Pope

Hi,

You can use the Count property to tell you how many points a series has.

ActiveChart.SeriesCollection(1).Points.Count

Cheers
Andy
 
J

Jon Peltier

The code will run more smoothly if instead of using

ActiveChart.SeriesCollection(1).Points(3).Select
Selection.Interior.Blah

you use

ActiveChart.SeriesCollection(1).Points(3).Interior.Blah

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top