PDA

View Full Version : How can I duplicate a series in the chart?



oleval
02-18-2008, 01:09 AM
Hi All,

I would like to have a code that would duplicate a series in the chart, which has just one series. In result, such a chart should have two indentical series.

Thanks a lot in advance!

Alex

Bob Phillips
02-18-2008, 02:13 AM
Just do it in Excel with the macro recorder on.

oleval
02-18-2008, 02:30 AM
Good idea!.. But I need more intellegent solution for this.
The matter is that I'm trying to do this in this way


ActiveChart.ChartArea.Select ' the chart has a series
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Values = ActiveChart.SeriesCollection(1).Values


...but it appears that last line is a wrong one... Is there a solution for this?

Thanks

Bob Phillips
02-18-2008, 06:20 AM
Oh dear, cross-posted at MrExcel http://www.mrexcel.com/forum/forumdisplay.php?f=10

I will cease wasting my time on the code to get the range forthwith.

oleval
02-18-2008, 06:22 AM
Why?

Bob Phillips
02-18-2008, 06:30 AM
Because whilst I am working on it, someone else at MrExcel may come also be working on a solution, so my time or thiers is wasted. As you didn't even have the grace to tell us and what the status was at the other place, I can't be bothered to potentially waste time. You may think it is a great idea to get all of these free resources working on your problem, after yours must be the only important problem in the world right now, but me ... I think it is rude.

oleval
02-18-2008, 06:39 AM
I'm so sorry indeed. I did not realsie that you have been working on this. I apologise.

oleval
02-19-2008, 08:33 AM
I have found the solution:

Set Series1 = .SeriesCollection(1)
Set Series2 = .SeriesCollection.NewSeries
Series2.Formula = Series1.Formula