L
LarryP
I have a macro that is supposed to reset three data ranges (one X, two Y)
based on the number of data rows in the current worksheet. The first two
work fine, the third one errors out, saying it is "unable to set the Values
property of the Series class." I'm I'm darned if I can see why, as the code
seems identical to the two previous lines. The code follows, and below that
a sample of the data it's referring to:
Sheets("S-curve Chart").Select
ActiveChart.ChartArea.Select
##works## ActiveChart.SeriesCollection(1).XValues = "='S-curve Chart
Data'!R2C1:R" & Chart6LastRow & "C1"
##works## ActiveChart.SeriesCollection(1).Values = "='S-curve Chart
Data'!R2C3:R" & Chart6LastRow & "C3"
##fails## ActiveChart.SeriesCollection(2).Values = "='S-curve Chart
Data'!R2C5:R" & Chart6LastRow & "C5"
ActiveChart.Deselect
Here's a few rows of the data from the worksheet (note that the code is using
columns A, C, and E, and note also that further down, ColE DOES have data in
it):
ColA ColB ColC ColD ColE
181 $0 $0 $-
180 $- $0 $-
179 $- $0 $-
178 $- $0 $-
177 $- $0 $-
176 $- $0 $-
175 $- $0 $-
based on the number of data rows in the current worksheet. The first two
work fine, the third one errors out, saying it is "unable to set the Values
property of the Series class." I'm I'm darned if I can see why, as the code
seems identical to the two previous lines. The code follows, and below that
a sample of the data it's referring to:
Sheets("S-curve Chart").Select
ActiveChart.ChartArea.Select
##works## ActiveChart.SeriesCollection(1).XValues = "='S-curve Chart
Data'!R2C1:R" & Chart6LastRow & "C1"
##works## ActiveChart.SeriesCollection(1).Values = "='S-curve Chart
Data'!R2C3:R" & Chart6LastRow & "C3"
##fails## ActiveChart.SeriesCollection(2).Values = "='S-curve Chart
Data'!R2C5:R" & Chart6LastRow & "C5"
ActiveChart.Deselect
Here's a few rows of the data from the worksheet (note that the code is using
columns A, C, and E, and note also that further down, ColE DOES have data in
it):
ColA ColB ColC ColD ColE
181 $0 $0 $-
180 $- $0 $-
179 $- $0 $-
178 $- $0 $-
177 $- $0 $-
176 $- $0 $-
175 $- $0 $-