Hi, All:

I am getting crazy about this error. I tried everything but no help at all. Here is the simple task I want to do: adding a chart. The code is as below:

ActiveChart.ChartType = xlXYScatterLines
Set myrange = Worksheets("Sheet1").Range("B16:B18")
ActiveChart.SetSourceData Source:=myrange, PlotBy:=xlColumns
ActiveChart.Location where:=xlLocationAsObject, Name:="Rates"

It always stops at line 3 and complaining about "Subscript out of range". But B16-B18 in sheet1 have data. Please anybody can help me? Thanks a lot!

You have tried to activate the Source Data and assign it to the "myrange" array, but the "myrange" array is just the range only, it should there be VALUE of the range!

commented: Rather late than never, thanks.:) +6

I'm sure the OP has found a solution since 2008, but no harm in adding an answer since there was no solution posted, thanks lhxndd.:)

I don't know whether or not yilin2008 could have found the solution for this, so I posted the solution for him!
Anyway, thanks everyone!

Do not hesitate to contact me and post question to daniweb.com. Thanks again!

My gmail is: [email snipped]