B
BW
Hello,
Been trying to tackle this very strange problem i have been having.
I have a pie-chart's x, y coordinates reference a contigous range of cells
for each x,y coordinate.
The following code works:
chartObj.Chart.SeriesCollection(1).Values = yRng
chartObj.Chart.SeriesCollection(1).XValues = xRng
where xRng, yRng are Range objects.
However, i get the following error message : "Unable to set the XValues
property of the Series class" when i try programmatically set the chart x to
the ACTUAL VALUE contained with xRng using the following way:
Dim xArray, yArray as variant
Dim i as long
For i = 1 To xRng.count
yArray(i - 1) = yRng.Cells(i, 1)
xArray(i - 1) = xRng.Cells(i, 1)
Next i
chartObj.Chart.SeriesCollection(1).Values = yArray
chartObj.Chart.SeriesCollection(1).XValues = xArray '->This line fails.
I don't understand as both methods should be equivalent. In the first
example, i'm setting the chart x,y coordinates to reference cells. In the
2nd example, i'm setting the chart x,y, coordianes to the actual data
contained within those same cells.
Can anyone see what i'm doing wrong or how i can better set the chart's x,y
references to the actual values. Unfortunatle the Workbook.BreakLinks method
doesn't exist in excel2000 for me to use to convert the chart's x,y refrences
to actual values.
Thanks,
Been trying to tackle this very strange problem i have been having.
I have a pie-chart's x, y coordinates reference a contigous range of cells
for each x,y coordinate.
The following code works:
chartObj.Chart.SeriesCollection(1).Values = yRng
chartObj.Chart.SeriesCollection(1).XValues = xRng
where xRng, yRng are Range objects.
However, i get the following error message : "Unable to set the XValues
property of the Series class" when i try programmatically set the chart x to
the ACTUAL VALUE contained with xRng using the following way:
Dim xArray, yArray as variant
Dim i as long
For i = 1 To xRng.count
yArray(i - 1) = yRng.Cells(i, 1)
xArray(i - 1) = xRng.Cells(i, 1)
Next i
chartObj.Chart.SeriesCollection(1).Values = yArray
chartObj.Chart.SeriesCollection(1).XValues = xArray '->This line fails.
I don't understand as both methods should be equivalent. In the first
example, i'm setting the chart x,y coordinates to reference cells. In the
2nd example, i'm setting the chart x,y, coordianes to the actual data
contained within those same cells.
Can anyone see what i'm doing wrong or how i can better set the chart's x,y
references to the actual values. Unfortunatle the Workbook.BreakLinks method
doesn't exist in excel2000 for me to use to convert the chart's x,y refrences
to actual values.
Thanks,