• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Data Point Labels

Ben Thiele

New Member
Hi,

I have a data set with three columns. There are names in Column A and numbers in Columns B and C. I made a scatter plot of the data in Columns B and C. When I label the data points, the point's y-axis value pops up automatically. I'd like the name from Column A to pop up instead. I know I can do this manually, but is there a way to do this automatically?

Much appreciated,
Ben
 
Something like this but it will need tweaking (Select the chart first):
Code:
Sub blah()
With ActiveChart
  .SetElement (msoElementDataLabelNone)
  .ApplyDataLabels
  .SeriesCollection(1).DataLabels.Position = xlLabelPositionAbove
  i = 1
  For Each pt In .SeriesCollection(1).Points
  pt.DataLabel.Text = Range("A2:A18").Cells(i).Value
  i = i + 1
  Next pt
End With
End Sub
where at least the Range("A2:A18") will need adjusting.
 
I sometime use a dummy data series plotted on the secondary axis. You can then set the category labels use the range with the custom labels text. Apply Category data labels to the dummy series.
 
Back
Top