Hi:
I am getting crazy with this problem that I have. I really appreciate if anybody can help me out. I am running on windows xp, using vba to create a macro to plot a simple chart.
If I use
ActiveChart.SetSourceData Source:=Sheets("gradingResult").Range("B16:B18"), _
PlotBy:=xlColumns
to setup the range, everything is fine, it runs ok.
But the thing is, the range will start at a dynamic number. So I will need to use cells in the range. But if I change it to:
ActiveChart.SetSourceData Source:=Sheets("gradingResult").Range(Cells(16, 2), Cells(18, 2)), _
PlotBy:=xlColumns
I think the 2 lines are doing the exactly same thing, why the second failed? It says runtime error 1004: method cells of object _Global failed.
Please help!! Many thanks,
I am getting crazy with this problem that I have. I really appreciate if anybody can help me out. I am running on windows xp, using vba to create a macro to plot a simple chart.
If I use
ActiveChart.SetSourceData Source:=Sheets("gradingResult").Range("B16:B18"), _
PlotBy:=xlColumns
to setup the range, everything is fine, it runs ok.
But the thing is, the range will start at a dynamic number. So I will need to use cells in the range. But if I change it to:
ActiveChart.SetSourceData Source:=Sheets("gradingResult").Range(Cells(16, 2), Cells(18, 2)), _
PlotBy:=xlColumns
I think the 2 lines are doing the exactly same thing, why the second failed? It says runtime error 1004: method cells of object _Global failed.
Please help!! Many thanks,