View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Please help with Range Cells

Vickie,

Hello Again,

It appears that your chart is on a sheet separate from that of
the chart data.
If that is the case then you need to qualify the Cells reference.
"Cells" without a qualifier refers to the active sheet.
So the reference should look like this...

Worksheets("Daily Input").Range(Worksheets("Daily Input").Cells(6, 9), _
Worksheets("Daily Input").Cells(17, 9))

Which can be written a little more efficiently as...
With Worksheets("Daily Input")
.Range(.Cells(6, 9), .Cells(17, 9))
End With
(notice the "." before Range and Cells.

Regards,
Jim Cone
San Francisco, USA


"vickie_raven" wrote in message
...
This is what the macro produced:
ActiveChart.SeriesCollection(1).Values = "='Daily Input'!R6C9:R17C9"
This is what I tried to do - but it gives an error.
I need to substitute the values in the Cells reference with vairables
for the module work correctly.
ActiveChart.SeriesCollection(1).Values = Worksheets("Daily
Input").Range(Cells(6, 9), Cells(17, 9))
Please tell me what I am doing wrong.