View Single Post
  #3   Report Post  
John Mansfield
 
Posts: n/a
Default

jj,

I apologize, I originally wanted to say that you can use this code to move
the data source for the chart (my original post was meant for another
question).

Sub ChangeSourceRange()
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("E2:F5")
End Sub

Set the source range to the reference in the code. Activate the chart by
clicking on it and run the macro. Hope this helps - sorry about that.

----
Regards,
John Mansfield
http://www.pdbook.com


"jj" wrote:

I am trying to change the datasource of an existing chart
in VBA. Is there a way to do this in VBA. Our isssue is that we are moving to
another source.

So the example would be we take a range from an existing worksheet and move
this to a new worksheet with the chart, but not in the same range. So the
variables would be that we need to adjust the source range be the difference
in the row or columns for each of the series. The main issue is how do we get
the data source of the existing chart series?

Thanks for any help.