PDA

View Full Version : Solved: Retrieve value from chart data label



ulfal029
02-12-2008, 03:48 AM
Hi,
is there a way to retrieve the X and Y data label values shown for a point in a XY scatter chart? Help appreciated.

ActiveChart.SeriesCollection(1).Points(4).ApplyDataLabels AutoText:=True, ShowCategoryName:=True, _
ShowValue:=True

Edit: To clarify my point; I have a XY scatter chart where some points have datalabels with the X and Y values, and I need to retrieve them by code. A guess would be something like:

Dim xValue As Long
xValue = ActiveChart.SeriesCollection(1).Points(4)...something

Trevor
02-18-2008, 04:59 PM
Is the x and y static ceils or is the value your are trying eo get dependene apon an entry in another cell?
do you have an exaple or maybe you can atearh what your working on with a more indepth description of the x and y value you are trying to obtain and is the value dependent apon an entry in another field.

Andy Pope
02-19-2008, 02:13 AM
This will return the text, which you can parse using the split function in order to get x and y value.


activechart.SeriesCollection(1).points(4).datalabel.text

JonPeltier
02-20-2008, 10:26 AM
If you want the values themselves:


Dim vX As Variant
Dim vY As Variant

vX = ActiveChart.SeriesCollection(1).XValues
vY = ActiveChart.SeriesCollection(1).Values

MsgBox "X=" & vX(4) & ", Y=" & vY(4)

ulfal029
02-21-2008, 03:56 AM
That should do it; thank you!