ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to find a charts data source (https://www.excelbanter.com/excel-programming/419602-macro-find-charts-data-source.html)

Kevin

Macro to find a charts data source
 
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

JLGWhiz

Macro to find a charts data source
 
DataSeries is the plot values.

"Kevin" wrote:

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


Andy Pope

Macro to find a charts data source
 
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..._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

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Kevin" wrote in message
...
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



Kevin

Macro to find a charts data source
 
THANK YOU!!!

I knew it had to be something simple. :-)

Kevin

"Andy Pope" wrote:

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..._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

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Kevin" wrote in message
...
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





All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com