index > Architecture, Tools, and Process for ISVs > Assigning new series to chart

Assigning new series to chart


Hello! I have previously posted questions in this field but I have never gotten an answer. I really really need help with this. I have never programmed before and now I am supposed to do this VBA application for Excel. What I want to do is simple enough but I have trouble implementing it and since and really do not know anything about programming I do not know what is wrong. The problem is that I am supposed to replace the existing series for a chart with new series. I have the new series but when applying them to a new chart it does not work if I have not manually erased the old chart series. This does not seem like an obstacle but this code have to work for other applications. I try to change the series in a loop. Code:

AndersBank

This forum is for Independent Software Vendors (ISVs) to get help with architecting and developing applications. This is a VBA question and should be posted to the VBA forum, but since you allready tried that without luck I'll try to help.

To change the data for a chart, there's two options:
a) Set the Values property of the SeriesCollection to a Range (i.e. ActiveChart.SeriesCollection(1).Values = ActiveSheet.Range("D1:D9"). In this sample I have two series; A1:A9 in SeriesCollection(1) and B1:B9 in SeriesCollection(2) and the code replaces the data in SeriesCollection(1) with the data from D1:D9. The chart updates immediately, no need to call any methods.

b) Set the Values property of the SeriesCollection to an array of values using the Array function such as ActiveChart.SeriesCollection(1).Values = Array(9, 8, 7, 6, 5, 4, 3, 2, 1) or by manually creating an array such as :
Dim numbers(9) As Integer

For i = 1 To 9
numbers(i) = i
Next

ActiveChart.SeriesCollection(1).Values = numbers




This posting is provided "AS IS" with no warranties, and confers no rights. MTC ISV Team [MSFT]
Michel Baladi
reply 2

You can use google to search for other answers

 

More Articles

• Gantt Chart component/library
• Data access layer generating software approach
• Does anyone know some good places to look for Architects
• implemnting cache in best possible way
• Introducing our newest forum!
• Independent. Sure, but at any price?
• Running script
• So Software as a Service is the next big thing ??again?
• Architecture - what it is and what it will be
• how to show wcf proxy's datasets to the ui layer in a three layer...
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• Data access layer generating software ap
• Gantt Chart component/library
• Independent. Sure, but at any price?
• Backup and Restore Data/Metadata for a N
• Running script
• The official welcome post
• Does anyone know some good places to loo
• how to show wcf proxy's datasets to the
• Architecture for the Download and Instal
• Introducing our newest forum!
• Assigning new series to chart
• implemnting cache in best possible way
• So Software as a Service is the next big
• Architecture - what it is and what it wi
• WMI.Net 2.0

Hot Articles

• WMI.Net 2.0
• Backup and Restore Data/Metadata for a N
• The official welcome post
• how to show wcf proxy's datasets to the
• Running script
• Independent. Sure, but at any price?
• So Software as a Service is the next big
• Assigning new series to chart
• Introducing our newest forum!
• Gantt Chart component/library
• Does anyone know some good places to loo
• Architecture - what it is and what it wi
• Architecture for the Download and Instal
• Data access layer generating software ap
• implemnting cache in best possible way

Recommend Articles

• Independent. Sure, but at any price?
• The official welcome post
• Data access layer generating software ap
• Backup and Restore Data/Metadata for a N
• Assigning new series to chart
• implemnting cache in best possible way
• So Software as a Service is the next big
• Architecture for the Download and Instal
• Introducing our newest forum!
• Running script
• Does anyone know some good places to loo
• Gantt Chart component/library
• Architecture - what it is and what it wi
• WMI.Net 2.0
• how to show wcf proxy's datasets to the