pastebin.ubuntu. com/p/DWRhhjg33B/
I recorded the macro, made it leaner, ran it on a different chart, and now the setelement for data labels doesn’t work, although the one for grid lines work perfectly.
1004: Method ‘SetElement’ of object ‘_chart’ failed. Idk how that could happen when the code is literally recorded.
'error: method 'SetElement' of object '_chart' failed
'ver 1
With ActiveChart
.Legend.Format.TextFrame2.TextRange.Font.Size = 7
.SetElement (msoElementPrimaryValueGridLinesMajor)
.SetElement (msoElementDataLabelOutSideEnd)
.FullSeriesCollection(2).DataLabels.Position = xlLabelPositionCenter
.FullSeriesCollection(1).DataLabels.Delete
End With
'ver 2
With ActiveChart
.Legend.Format.TextFrame2.TextRange.Font.Size = 7
.SetElement (msoElementPrimaryValueGridLinesMajor) 'And (msoElementDataLabelOutSideEnd)
.FullSeriesCollection(2).DataLabels.Position = xlLabelPositionCenter
.FullSeriesCollection(1).DataLabels.Delete
End Wit
Bookmarks