Macro to find a charts data source

K

Kevin

What property can I refer to in a macro to get the data source of a chart.
Any data source would do, be it a title or value anything that refers to one
or some of the cells a chart gets it data from..

Thanks,
Kevin
 
A

Andy Pope

Hi,

To discover the ranges used in a charts data series you would need to parse
the Formula property of the series.
John Walkenbach has a class for parsing the formula.
http://spreadsheetpage.com/index.php/file/a_class_module_to_manipulate_a_chart_series/

Activechart.seriescollection(1).Formula

which will return you something like this.

=SERIES(Sheet1!$B$1,Sheet1!$A$2:$A$5,Sheet1!$B$2:$B$5,1)

You can read the .Values and .XValues of the series in to variant arrays.
But this will be numbers not cell addresses.

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top