Unable to set XValues Property of Series Class

G

Guest

I am using a variable to dictate which chart series I am working with however
I am recieving the following error:

Run-time error '1004'
Unable to set XValues property of Series Class

My code looks like:
Dim StrtRng, i As Long

'Redirect Chart Elements
TierVar = Range(Comp3Tier.Address).Value 'ActiveCell.Offset(0,
(Comp3Tier.Column - CostRng.Column)).Value

With Charts(activesheet.Name & "_Chart")
'RngStrg
..SeriesCollection(TierVar).XValues = "=DataSheet!R" & StrtRng & "C5:R" & i &
"C5"
..SeriesCollection(TierVar).Values = "=DataSheet!R" & StrtRng & "C6:R" & i &
"C6"
..SeriesCollection(5).XValues = "=DataSheet!R" & i & "C7:R" & (i + 1) & "C7"
..SeriesCollection(5).Values = "=DataSheet!R" & i & "C8:R" & (i + 1) & "C8"
..SeriesCollection(4).XValues = "=DataSheet!R" & i & "C9:R" & (i + 1) & "C9"
..SeriesCollection(4).Values = "=DataSheet!R" & i & "C10:R" & (i + 1) & "C10"
..SeriesCollection(6).XValues = "=DataSheet!R" & i & "C11:R" & (i + 1) & "C11"
..SeriesCollection(6).Values = "=DataSheet!R" & i & "C12:R" & (i + 1) & "C12"
..SeriesCollection(7).XValues = "=DataSheet!R" & i & "C13:R" & (i + 1) & "C13"
..SeriesCollection(7).Values = "=DataSheet!R" & i & "C14:R" & (i + 1) & "C14"
End With
StrtRng = i + 1
End If
ActiveCell.Offset(1, 0).Activate
i = i + 1

Loop
 
J

Jon Peltier

Make sure the range contains valid data. Also, I doubt that it matters, but
I invariably define the Y values first.

- Jon
 
G

Guest

I should mention that I initially had no problems with this code and this
issue only arises occasionally and I haven't figured out the rhyme or reason
why it occasionally works. I have played around with it several different
ways and each time the data is valid [numerical] and I tried changing order
of .xvalues and .values statements, but still this occurs no matter which
statement is first.

Does anyone know if I should be using the .formula method rather than .value
? Any ideas??

-D
 

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

Top