Adjusting Chart Source Data in VBA


Posted by Mike on January 05, 2002 11:06 AM

What would it take to shift the source data range for a chart to the left or right in VBA? For example, lets say I graph some data in a range from C3 to E7 and I want to shift the range to B3 to E6. I don't want to move the data, I need to change where the chart looks for the data.

Thanks...Mike

Posted by Mike on January 05, 2002 11:20 AM

Well, I found out how to set the new range using the SetSourceData method, but how do I find the current source data?

Thanks...Mike



Posted by Mike on January 06, 2002 7:05 PM

Well, I found out that Excel does not expose the range of a chart to VBA. It can be set from VBA but not read. However, I found a site that has a Class that allows you to read the range of a chart. The address is:

http://j-walk.com/ss/excel/tips/tip83.htm

Thanks...Mike