N
Nigel
Hi All
I am havig some problems when setting the xvalues for a chart. The data is
stored in a named range (data), the xvalues are in the same range (column
1). The problem arises in that the the numer of rows in the range can vary
so the xvalues must also change.
I have overcome the source data by making reference to the range name (see
below) but I have not been able to figure out what I need to do for the
xvalues which are recorded as a R1C1 reference in the following code.
What code do I need to put in to make it universal in relation to my varying
data range?
TIA
Nigel
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("data"),
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R4C1:R21C1"
I am havig some problems when setting the xvalues for a chart. The data is
stored in a named range (data), the xvalues are in the same range (column
1). The problem arises in that the the numer of rows in the range can vary
so the xvalues must also change.
I have overcome the source data by making reference to the range name (see
below) but I have not been able to figure out what I need to do for the
xvalues which are recorded as a R1C1 reference in the following code.
What code do I need to put in to make it universal in relation to my varying
data range?
TIA
Nigel
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("data"),
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R4C1:R21C1"