How to change data label width in an Excel chart with VBA?

Viewed 1908

I want to change a label width in Excel chart by VBA code:

set lbl = SERIES1. points(1).datalabel
msgbox lbl.width 'this is working

lbl.width = 40 ' compile error: wrong number of arguments or invalid property assignment

I can get the label width but cannot change it. What am I doing wrong?

2 Answers

This works in Excel 2016, you'll just need to adjust the series collection and point numbers to fit your needs. ActiveChart.FullSeriesCollection(1).Points(1).DataLabel.Width = 363.314.

Related