ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell references when creating charts (https://www.excelbanter.com/excel-programming/372979-cell-references-when-creating-charts.html)

Laura

Cell references when creating charts
 
I want to refer to my cell range using
range(cells(row,column),cells(row,column))
as I am running this within a loop. However the only code I can get to work
is the two forms below. Is there another way or can I use the above syntax a
different way to get around this?

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SeriesCollection(1).Values = Sheets("EV3
flow").Range("B10:B446")
ActiveChart.SeriesCollection(1).XValues ="='EV3 depth'!R10C2:R446C2"

Tom Ogilvy

Cell references when creating charts
 
=range(cells(row,column),cells(row,column)).Addres s(1,1,xlA1,True)

or change xlA1 to xlR1C1

or just
With Worksheets("Sheet1")
set rng = .range(.cells(row,column),.cells(row,column))
End with
ActiveChart.SeriesCollection(1).Values = rng

--
Regards,
Tom Ogilvy



"Laura" wrote:

I want to refer to my cell range using
range(cells(row,column),cells(row,column))
as I am running this within a loop. However the only code I can get to work
is the two forms below. Is there another way or can I use the above syntax a
different way to get around this?

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SeriesCollection(1).Values = Sheets("EV3
flow").Range("B10:B446")
ActiveChart.SeriesCollection(1).XValues ="='EV3 depth'!R10C2:R446C2"



All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com