View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default How to set Chart SetSourceData in code..?

Just noticed this

Charts("Chart1").SeriesCollection(1).Values =
Worksheets("Sheet1").Range(Cells(r1, c1), Cells(r2,c2))

If Sheets1 isn't the active sheet, you may have problems with the Cells
piece since it's pointing to the active sheet.

"Andrew" wrote:

I have...

Worksheet("Sheet1")
r1, c1, r2, c2 As Integer

r1 = 24: c1 = 2: r2 = 68: c2 = 2

Charts("Chart1").SeriesCollection(1).Values =
Worksheets("Sheet1").Range(Cells(r1, c1), Cells(r2,c2))

r1 & r2 will change according to user interaction in other code.
What have i missed..?

Any help would be greatly appreciated. ;)