Sub AddDataLabels()
Dim seSales As Series
Dim pts As Points
Dim pt As Point
Dim rngLabels As range
Dim iPointIndex As Integer
Set rngLabels = range("B4:G4")
Set seSales = ActiveSheet.ChartObjects(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 = True
pt.DataLabel.Position = xlLabelPositionAbove
Next pt
End Sub
|