VBA get name of point in Chart series

Hi all,

 

I'm tearing my hair apart here trying to get the name of any given point in a stacked column chart. When mousing a point I get a tooltip that says "Series "[series name]", Point "[point name]", Value 84".

What I want to do is to get the Name of the point displayed with VBA - this is all a part of a search and find algorithm for certain data points in a dynamically created chart.

However, trying to get that name is frustrating at best.

Trying this: ActiveChart.SeriesCollection(1).Points(1).Name just gives me "S1P1", which is really just shorthand for "Point number one in Series number 1".

Getting the series name is very easy - ActiveChart.SeriesCollection(1).Name returns the name of the series, not in any "S1" notation, but the actual name.

How then, do I go about getting the name of any specific point?

Have also tried ActiveChart.SeriesCollection(1).Points(1).DataLabel.Parent.Name but this also just gives me "S1P1". But since the mouseover tooltip provides the actual name of the point there must be a way to get that programatically with VBA.

 

Grateful for any help with this.

 

Thanks,

Marcus

Answer
Answer

The names are the x values of the series. Try this:

 

Dim varValues As Variant
Dim strName As String
varValues = ActiveChart.SeriesCollection(1).XValues
strName = varValues(1)

---
Best wishes, HansV
https://www.eileenslounge.com

13 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated January 30, 2024 Views 6,272 Applies to: