I have problem with the data label position in the following code. It works fine for updating chart and showing the data labels in the center but I want data labels on top of bars. The code gives me error "Method 'Position' of object 'DataLabels' failed"
I am not sure what i am doing wrong. Any help is much appreciated.
Code:
lcol = INV.Range("N" & 4).End(xlToLeft).Column
Set RngSOL = INV.Range(INV.Cells(4, lcol), INV.Cells(9, lcol))
Set rngsolx = INV.Range("B4", "B9")
End With
Set Chart3 = db.ChartObjects("Chart 6").Chart
With Chart3
.ChartType = xlColumnStacked
.SetSourceData Source:=rngsolx
With .SeriesCollection.NewSeries
With Chart3.SeriesCollection(1)
.Values = RngSOL
.XValues = rngsolx
.ApplyDataLabels
.DataLabels.ShowValue = True
.DataLabels.Position = xlLabelPositionAbove
.Interior.Color = RGB(0, 112, 192)
End With
End With
End With
End Sub