Thread: Plot Ranges
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Plot Ranges

When you use the With ActiveChart and then tell it the source is in in
Range(Cells.... it does not find Cells with ActiveChart. Although you
thought you qualified the Cells with Worksheets(1), VBA don't acknowledge it.
So in the second case where you first qualified the range by setting it to
Worksheets(1) in a variable before trying to apply it, it does acknowledge
it. I do the same thing repetitively and I should know better.

"MikeM" wrote:

I can write

With ActiveChart
.ChartType = xlXYScatterLinesNoMarkers
.SetSourceData Source:=Sheets(1).Range(Cells(1, 1), Cells(15, 2))
End With

but this doesn't work

setrA = Sheets(1).Range(Cells(1, 1), Cells(15, 2))
With ActiveChart
.ChartType = xlXYScatterLinesNoMarkers
.SetSourceData Source:=rA
End With

Can someone explain why? [I don't want just a fix, but an understanding of
plotting procedures.

TIA,
Mike