Hi,
As the title states, I'm trying to add the same range of data labels (initials) to 9 out of a total of 13 charts on one sheet. I'm using this popular macro to add labels successfully to 1 chart (Chart 1):
I would sincerely appreciate help in finding a - smooth - solution to this, that allows me to select which charts should have the labels added to them. I've tried fooling around with ChartObject.Array() and some other things but without success. If you need additional information I'll be glad to assist.
Best,
Richard
As the title states, I'm trying to add the same range of data labels (initials) to 9 out of a total of 13 charts on one sheet. I'm using this popular macro to add labels successfully to 1 chart (Chart 1):
Code:
Sub AddDataLabels()' Disable screen updating while the subroutine is run.
Application.ScreenUpdating = False
Dim seSales As Series
Dim pts As Points
Dim pt As Point
Dim rngLabels As Range
Dim iPointIndex As Integer
Set rngLabels = Range("AutoCalculations!$B$2:$B$50")
Set seSales = Sheets("AutoReport").ChartObjects("Chart 1").Chart.SeriesCollection(1)
seSales.HasDataLabels = True
Set pts = seSales.Points
For Each pt In pts
iPointIndex = iPointIndex + 1
pt.DataLabel.Text = rngLabels.Cells(iPointIndex).Text
pt.DataLabel.Font.Bold = False
pt.DataLabel.Position = xlLabelPositionCenter
Next pt
End Sub
I would sincerely appreciate help in finding a - smooth - solution to this, that allows me to select which charts should have the labels added to them. I've tried fooling around with ChartObject.Array() and some other things but without success. If you need additional information I'll be glad to assist.
Best,
Richard