View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
TroyW[_2_] TroyW[_2_] is offline
external usenet poster
 
Posts: 94
Default chart point value

Claude,

Does the code below do what you want? The referencing of the chart depends
upon whether it is a standalone chart sheet or an embedded chart on a
worksheet.

Troy

Sub WorksheetEmbeddedChart()
Dim ws As Worksheet
Dim cht As Chart
Dim ser1 As Series
Dim ii As Integer

Set ws = ThisWorkbook.Worksheets("Sheet1")
'Note: the name of the chart is: "Chart(space)1".
Set cht = ws.ChartObjects("Chart 1").Chart
Set ser1 = cht.SeriesCollection(1)
ii = 2
MsgBox "Series1(" & ii & "): x=" & _
ser1.XValues(ii) & ", y=" & ser1.Values(ii)
End Sub


Sub ChartSheet()
Dim cht As Chart
Dim ser1 As Series
Dim ii As Integer

'Note: the name of the chart is: "Chart1".
Set cht = ThisWorkbook.Charts("Chart1")
Set ser1 = cht.SeriesCollection(1)
ii = 2
MsgBox "Series1(" & ii & "): x=" & _
ser1.XValues(ii) & ", y=" & ser1.Values(ii)
End Sub


"Claude" wrote in message
...
Hi all

How can I address a specific data point on a chart to give
back the specific (y)value?

the following does not work:
MsgBox (ActiveChart.SeriesCollection(1).Points(1).Value)