473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to duplicate a series in the MS Excel chart?

1
Hi All,

I need a VBA MS Excel code to duplicate a series in the chart, which has just one series. Effectively, as a result the chart should have two identical serieses.

Thank you for your help!

PS. I tried this code, but it ends up with run-time error...

ActiveChart.ChartArea.Select ' the chart has one series
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Values = ActiveChart.SeriesCollection(1).Values
Feb 18 '08 #1
1 3715
kadghar
1,295 Expert 1GB
Hi All,

I need a VBA MS Excel code to duplicate a series in the chart, which has just one series. Effectively, as a result the chart should have two identical serieses.

Thank you for your help!

PS. I tried this code, but it ends up with run-time error...

ActiveChart.ChartArea.Select ' the chart has one series
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Values = ActiveChart.SeriesCollection(1).Values
the error might be because the chart is not selected when you run this code, and there's no ActiveChart. So you can select the chart before running or write a line to reference the desired chart, something like

Expand|Select|Wrap|Line Numbers
  1. Workbooks("theBooksName").worksheets("theSheetsName").chartobjects("theChartsName").activate
of course you can skip the Workbooks part, and replace the worksheets part with ActiveWorksheet, but once again you'll have to be sure to have the right book and sheet selected.

The name of the chart is put by Excel, it should be something like "Chart01" or "Chart02" or something like that. To know it, use the macro recorder. Select anything but the chart, and then select the chart and stop recording. When you see the recorded code, you'll see the chart's name in a line quite similar to the one i've just write above.

HTH
Feb 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
0
by: mscir | last post by:
Date: Thu, 08 Jul 2004 17:02:27 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <10ero4l3kp2qa65@corp.supernews.com> Reply-To: mscir@usa.com User-Agent: Mozilla/5.0...
1
by: ian.davies52 | last post by:
I have an msgraph on a form. The chart has five series on it. On the same form I have five checkboxes. I'm trying to make it so that checking/unchecking a checkbox will result in each of the series...
0
by: pmclinn | last post by:
The code below takes the data from the S column and grabs all the data and graphs it. The problem is this example grabs 500 cells worth of data and some of these cells = nothing. How do I rescope...
1
by: tdeve | last post by:
I am creating excel charts via C# and would need to dynamically create N number of series for a particular chart. I have yet to come across a viable solution that meets my needs and am open to any...
0
by: naish | last post by:
Hi, My code drawing a graph in excel sheet. There one colum for lower pressure and another one for upper pressure. Any howi can draw a series for one pressure but i am not able to draw two series...
9
by: AGP | last post by:
I have a VB6 application that has an OLE container with an embedded Excel chart. Our office updated to Excel 2007 and now although the app works the charts looks like crap. Since the app is fairly...
4
by: keirnus | last post by:
Hello, I've been coding in Access VBA to create an Excel Graph and it was good. Until I got this error: Please check the code below: Private Sub TestGraph3()
0
by: deve8ore | last post by:
Hello... I have a number of graphs I receive from a 3rd party vendor, and within the graphs are charts indicating specific membership information. I.e. - "Red Membership", "Blue Membership", "Green...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.