Please help with a simple chart problem(range setting).

Joined
Apr 22, 2008
Messages
1
Reaction score
0
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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top