View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
K Dales K Dales is offline
external usenet poster
 
Posts: 131
Default Assigning data source to chart

Set the Values and XValues properties to be the actual
range object, not a formula - for you this is complicated
by the fact that you can't use R1C1 notation for the range
address, but this should work:

ActiveChart.SeriesCollection(ColNum).XValues =
ActiveSheet.Range(ActiveSheet.Cells(i +
1,2),ActiveSheet.Cells(i + 1,10))

etc...


-----Original Message-----
I am trying to add a number of data series to a chart

however I get an error
(object doesn't support this property or method) when

running this piece of
code.

Dim Cname, i, ColNum
Cname = "Cht-" & ActiveSheet.Name

Charts.add.Name = Cname
ActiveChart.ChartType = xlXYScatter
ColNum = 1
i = 3
Do Until ActiveSheet.Range("A" & i) = ""
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(ColNum).XValues

= "=" &
ActiveSheet.Name & _
"!R" & i + 1 & "C2:R" & i + 1 & "C10"
ActiveChart.SeriesCollection(ColNum).Values = "="

& ActiveSheet.Name
& _
"!R" & i + 2 & "C2:R" & i + 2 & "C10"
ActiveChart.SeriesCollection(ColNum).Name = "=" &

ActiveSheet.Name & _
"!R" & i & "C1"
i = i + 6
ColNum = ColNum + 1
Loop
ActiveChart.Location Whe=xlLocationAsObject,

Name:=ActiveSheet.Name

It might not be the right way to do this so any

suggestions are welcome.

Thanks
The Doctor
.