Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default chart point value

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)

  #2   Report Post  
Posted to microsoft.public.excel.programming
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)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default chart point value

I think it's easiest if you first assign all the values to an array,
then use the array to access the individual values.

eg.

Dim i As Integer
Dim v As Variant

v = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1).Values

For i = 1 To UBound(v)
MsgBox v(i)
Next i


Regards,
Vic Eldridge


"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)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default chart point value

Well now I'm confused.
Check out this little macro. The first MsgBox works but the second one fails.
She's a fussy old thing hey ?

Sub Huh()
Dim srs As Series
Set srs = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
MsgBox srs.Values(1)
MsgBox ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1).Values(1)
End Sub

Regards,
Vic Eldridge



"TroyW" wrote in message ...
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)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default chart point value

Hi Vic

Sorry for the late reply. The idea with first adding the
values to an array is a simple solution that works, thanks!

Thanks also to Troy for pointing out the XValues(i) syntax
(also I was struggling to implement it: maybe it's because
I'm still using excel97...)


-----Original Message-----
Well now I'm confused.
Check out this little macro. The first MsgBox works but

the second one fails.
She's a fussy old thing hey ?

Sub Huh()
Dim srs As Series
Set srs = ActiveSheet.ChartObjects

(1).Chart.SeriesCollection(1)
MsgBox srs.Values(1)
MsgBox ActiveSheet.ChartObjects

(1).Chart.SeriesCollection(1).Values(1)
End Sub

Regards,
Vic Eldridge



"TroyW" wrote in message

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

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default chart point value

But this line works in place of your second:

MsgBox WorksheetFunction.Index(ActiveSheet.ChartObjects(1 ) _
.Chart.SeriesCollection(1).Values, 1)

Go figure.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Vic Eldridge wrote:

Well now I'm confused.
Check out this little macro. The first MsgBox works but the second one fails.
She's a fussy old thing hey ?

Sub Huh()
Dim srs As Series
Set srs = ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1)
MsgBox srs.Values(1)
MsgBox ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1).Values(1)
End Sub

Regards,
Vic Eldridge



"TroyW" wrote in message ...

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)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I link comments on the chart to a point on the chart? RL Charts and Charting in Excel 1 October 11th 07 10:03 AM
Series point on a chart Anthony Blackburn Excel Discussion (Misc queries) 2 August 7th 06 04:26 PM
Return value of a point in a bar chart Eric_B Charts and Charting in Excel 2 April 4th 06 06:01 PM
Chart Point Analysis Neil Charts and Charting in Excel 4 April 24th 05 04:06 AM
finding the value of a point on chart lifeguard_911 Charts and Charting in Excel 1 April 20th 05 03:01 PM


All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"