View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Series Collection Results in Runtime Error 1004

I replicated your code and didn't get an error (having first ensure the
chart contained the three named series). But are you sure you want to update
each series with different XValues. I changed all your .XValues to .Values
(ie on the Y axis) and added two more lines

Value4 = "='Sheet1'!R" & startrow & "C5:R" & endrow & "C5"
CHT.SeriesCollection("Cumulative Actual").XValues = Value4

With category X labels in col-5 it worked and seemed to make sense.

Regards,
Peter T

With
"Matthew Cunliffe" <Matthew wrote in
message ...
Hello,

I have an existing chart on a worksheet for which I am trying to update

the
XValues for each series. The update works for the first series that I

want
to change, but on the subsequent ones, it raises a Runtime Error 1004.

The
original values in each series are all valid. If I swap the series around
(so that the second and third are before the first) then the error occurs
immediately.

Below is a cut-down version of the code I am using. The startrow and

endrow
variables are normally populated from elsewhere.

If anyone could give me a pointer as to why it works for the first series
but fails on all subsequent ones I would be grateful.

Set CHT = Worksheets("Chart").ChartObjects("Chart 1").Chart

startrow = 152
endrow = 196

Value1 = "='Overall Progress - Tabular'!R" & startrow & "C6:R" & endrow &

"C6"
Value2 = "='Overall Progress - Tabular'!R" & startrow & "C8:R" & endrow &

"C8"
Value3 = "='Overall Progress - Tabular'!R" & startrow & "C10:R" & endrow &
"C10"

CHT.SeriesCollection("Cumulative Actual").XValues= Value1
CHT.SeriesCollection("Cumulative Predictive Failed").XValues = Value2
CHT.SeriesCollection("Cumulative Actual Failed").XValues = Value3