Adjust series order in Excel 2007

M

MikeM_work

We are trying to automate the creation of a column chart with two data
series, wherein one of the series is attached to the secondary axis. We
create two additional 'dummy' or blank series with zero values (two series
attached to primary axis; two series attached to secondary axis) so the
secondary column series does not 'jump' in front of the primary column series.

We cannot dictate the order of the series on the worksheet to the user, so
we need to be able to adjust the series order.

Does anyone know the code to manipulate the series order in Excel 2007?

Thank you very much.

Mike
 
I

ilia

There is a property you can set in the Series object to move to
secondary axis. The following line will move the first series of the
active chart to the secondary axis:

ActiveChart.SeriesCollection(1).AxisGroup = xlSecondary

If you want to change the order of their appearance, you have to do it
by chart group. This code will cause the first series of the first
chart group of the active chart to be plotted second:

ActiveChart.ChartGroups(1).SeriesCollection(1).PlotOrder = 2

Hope that helps.
 

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