View Single Post
  #5   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..?

I don't do this often, so you may want to look here for ideas

http://peltiertech.com/Excel/ChartsH...kChartVBA.html

HTH,
Barb Reinhardt

"Andrew" wrote:

Made sure Sheet is active..

Runtime Error '9':
Subscript out of range

Nice try though Barb..!

"Barb Reinhardt" wrote in
message ...
| 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. ;)
|
|
|
|