Microsoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may
want to contact a Microsoft Certified Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please visit the following Microsoft Web site:
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
To add a new series to a chart in Microsoft Excel using the
SeriesCollection object, use either of the following methods.
Method 1: Create a New Series from an Array
Although you cannot create a new series from an array in one statement,
it is possible to use two steps to complete the task. The following is
an example of using this two-step method:
Sub Series()
Sheets("Sheet1").Select ActiveSheet.ChartObjects(1).Select
Set ns = ActiveChart.SeriesCollection.NewSeries
With ns
.Values = Array(5, 6, 7)
End With
End Sub
Method 2: Use the Add Method
To add a new series to a chart in Microsoft Excel using the
Add method of
the
SeriesCollection object, use a
Range as the
Source argument. For
example, to add the range C1:C4 on Sheet1 as a new series to the active
chart, use the following syntax:
ActiveChart.SeriesCollection.Add _
Source:=Sheets("Sheet1").Range("C1:C4")