Luc -
I prefer to use ActiveSheet.ChartObjects.Add rather than Charts.Add to
add a chart object ot the sheet. Using ChartObjects.Add, you get a new
chart object with no series in it. Sometimes with Charts.Add you get a
dummy series in the new chart. I show some of these code examples he
http://www.geocities.com/jonpeltier/...kChartVBA.html
- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______
Luc Larochelle wrote:
Hi,
I was wondering why sometimes I get a "400" error with the
following code. The problem is mostly with the
line "Activechart.seriescollection.newseries". If I don't
use it sometimes I get an error message and the graphs
won't appear and sometimes I won't get any problem at all.
If I use it sometimes my graphs will appear normal with
only one serie on it, but sometimes I'll get 2 series and
2 different colors with unknown values ?! I would like to
have complete control over the automated graph process and
I don't want such anomalies to happen. Could anyone please
help me with this ?
Thanks a lot
Luc Larochelle
For x = 0 To UBound(types_graph)
Worksheets("calculs").Activate
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.Location _
Whe=xlLocationAsObject,Name:="Calculs"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Values = Worksheets _
("calculs").Range(Cells(3, x + 3), Cells(max_crew + 3, _
x + 3))
ActiveChart.SeriesCollection(1).XValues = Worksheets _
("calculs").Range(Cells(3, 2), Cells(max_crew + 3, 2))
With ActiveChart
.HasTitle = True
...
End With
Next x