T
Trevor Williams
I have two questions that I'm sure you can help me with
QUESTION 1.
I'm trying to select the whole range below E9 that contains data using the
following code:
Set myXValues = Worksheets("Model").Range("E9").End(xlDown)
This selects the LAST cell under cell E9 that contains data, not the whole
range
but, if I use this code:
Set myXValues = Worksheets("Model").Range("E9", Selection.End(xlDown))
It selects every cell from E9 to E65536
So, what's the correct way of doing it, without select E9 first, and then
using Selection.End(xldown)?
QUESTION 2
Once I've successfully selected the range, I need to set it as the XValues
in a chart.
I've been dabbling, but seems that the SeriesCollection needs to use the
R1C1 range style - is this right?
My 'non-functioning' code is below - Any help in these queries would be great.
Thanks
Trevor Williams
With Sheets("Sheet1").ChartObjects("Chart 1")
.SeriesCollection(1).XValues = myXValues
.SeriesCollection(1).Values = "=Model!R9C6:R11C6"
.SeriesCollection(2).XValues = myXValues
.SeriesCollection(2).Values = "=Model!R9C7:R11C7"
End With
QUESTION 1.
I'm trying to select the whole range below E9 that contains data using the
following code:
Set myXValues = Worksheets("Model").Range("E9").End(xlDown)
This selects the LAST cell under cell E9 that contains data, not the whole
range
but, if I use this code:
Set myXValues = Worksheets("Model").Range("E9", Selection.End(xlDown))
It selects every cell from E9 to E65536
So, what's the correct way of doing it, without select E9 first, and then
using Selection.End(xldown)?
QUESTION 2
Once I've successfully selected the range, I need to set it as the XValues
in a chart.
I've been dabbling, but seems that the SeriesCollection needs to use the
R1C1 range style - is this right?
My 'non-functioning' code is below - Any help in these queries would be great.
Thanks
Trevor Williams
With Sheets("Sheet1").ChartObjects("Chart 1")
.SeriesCollection(1).XValues = myXValues
.SeriesCollection(1).Values = "=Model!R9C6:R11C6"
.SeriesCollection(2).XValues = myXValues
.SeriesCollection(2).Values = "=Model!R9C7:R11C7"
End With