Excel Chart SeriesCollection Formula



I am trying to use VBA code to capture the X and Y values of existing chart.
The auto convertion to exponential format is give me problem. Please find the
details below:
VBA code :
Set obj = ActiveSheet.ChartObjects(cnt1).Chart
for series_cnt=1 to obj.SeriesCollection.Count
seriesFormula = obj.SeriesCollection(series_cnt).Formula
msgbox seriesFormula

The formula which I am trying to retrieve is

From 1006511,965152,976880, it is getting displayed in Exponential format
with output being


I need vba code which will help us to retain the value as it is and not to
get converted in Exponential format and with no truncation. These are chart
plot points.

Jon Peltier

When I run your code I get the correct formula in my message box.

If you want to get the X and Y values, use this:

vXValues = obj.SeriesCollection(series_cnt).XValues
vYValues = obj.SeriesCollection(series_cnt).Values

vXValues and vYValues should be declared as type Variant, not Variant().
Each contains an array of values.

- Jon

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

Similar Threads