Excel Chart Add Series with VBA

  • Thread starter Thread starter Juan Schwartz
  • Start date Start date
J

Juan Schwartz

Let's say

chartdepth = "0,1,2,3,4,5,6,7"
chartdays = "0,1,2,3,4,5,6,7,8,9"

When I execute the following code, the values for .XValues fills in
just fine, but the data for .Values just sits at 0.

Dim MyNewSrs As Series
Set MyNewSrs = ActiveChart.SeriesCollection.NewSeries
With MyNewSrs
.Name = well_array(k, 2)
MsgBox (chartdepth)
.Values = Array(chartdepth)
.XValues = Array(chartdays)
End With

Can anyone help me out?
 
Let's say

chartdepth = "0,1,2,3,4,5,6,7"
chartdays = "0,1,2,3,4,5,6,7,8,9"

When I execute the following code, the values for .XValues fills in
just fine, but the data for .Values just sits at 0.

Dim MyNewSrs As Series
Set MyNewSrs = ActiveChart.SeriesCollection.NewSeries
With MyNewSrs
.Name = well_array(k, 2)
MsgBox (chartdepth)
.Values = Array(chartdepth)
.XValues = Array(chartdays)
End With

Can anyone help me out?

Just to add, the "arrays" have the same number of items in each...
 
Just to add, the "arrays" have the same number of items in each...

Figured it out... you just don't put ARRAY() around the vars



chartdepth = "0,1,2,3,4,5,6,7"
chartdays = "2,3,4,5,6,7,8,9"

Dim MyNewSrs As Series
Set MyNewSrs = ActiveChart.SeriesCollection.NewSeries
With MyNewSrs
.Name = well_array(k, 2)
MsgBox (chartdepth)
.Values = Array(chartdepth)
.XValues = Array(chartdays)
End With
 

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

Similar Threads


Back
Top