Error number 1004

A

Alain Turgeon

Hi to everybody,

I use the line below to select data for creating a chart:

ActiveChart.SetSourceData Source:=Sheets("résultats").Range
(Cells(1, 1), Cells(k + 1, i + 1)), _
PlotBy:=xlRows

I have the error number 1004 when I execute this line. I
know that I can not use Cells inside a Range procedure but
how can I select a range of cells in some other way?

Thanks for the help!
 
B

Bob Phillips

Alain,

You can use Cells inside a Range property, but your problem is probably
caused by not qualifying the statement.

Try

With Sheets("résultats")
ActiveChart.SetSourceData Source:=.Range(.Cells(1, 1), .Cells(k + 1, i +
1)), _
PlotBy:=xlRows
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Hi to everybody,

I use the line below to select data for creating a chart:

ActiveChart.SetSourceData Source:=Sheets("résultats").Range
(Cells(1, 1), Cells(k + 1, i + 1)), _
PlotBy:=xlRows

I have the error number 1004 when I execute this line. I
know that I can not use Cells inside a Range procedure but
how can I select a range of cells in some other way?

Thanks for the help!
 
Top