Lived


Hi,

I'm quite noob with VBA and currently working on a project using excel. I need to programatically plot two data series on the same chart, one on primary axis and the other on secondary. if i use SeriesCollection.NewSeries to add new series, by default, the series will be plotted on primary axis. So do anyone know a way to plot the new added series on secondary axis Please help me, thank very much in advance.

Chi




Re: VBA for excel - plot series data on secondary axis

Andy Pope


Hi Chi,

Something like this should do it.

Code Snippet

With ActiveChart
With .SeriesCollection.NewSeries
.Values = Range("D18:D22")
.Name = Range("D17")
.AxisGroup = 2
End With
End With








Re: VBA for excel - plot series data on secondary axis

Lived

@Andy: it works well for me, thanks alot