

AddNodes msoSegmentLine, msoEditingAuto, pt.DataLabel.Left + pt.DataLabel.Width + lKink, pt.DataLabel.Top + pt.DataLabel.Height / 2 Set shpLeaderLine = (msoEditingAuto, pt.Left, pt.Top)Ĭase Is pt.DataLabel.Left + pt.DataLabel.Width Set pt = ActiveChart.SeriesCollection(a).Points(b) Private Sub clsChart_Mouseup(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)ĪctiveChart.GetChartElement x, y, IDNum, a, bĪctiveChart.Shapes("LeaderLine_" & a & "_" & b).Delete In fact, this is the first Class Module I have ever written: For instance, let’s park that 5th data label directly over the point it refers to:Īnd if the data label obscures the point, no leader line is produced: Just like in Excel 2013, my routine intelligently connects the leader line to the appropriate side of the data label, depending on it’s position relative to the point it connects to. For instance, let’s drag that 4th data label North-East:

I added these via using a Freeform shape, and the code lives inside a Class Module, so that if you move a data label around, the leader line gets redrawn. Ha! Fooled you…those are my programaticaly applied lines in Excel 2010. So I thought I’d have a crack at programatically adding leader lines to ‘Peltier-approved’ chart types via VBA shapes.įirst, let’s look at what those native leader lines in Excel 2013 look like, eh? And we all know what Peltier would say about that, don’t we. If you want to use Leader Lines in earlier versions, then they are only available if you use a pie chart. I love the Leader Lines that Excel 2013 puts in for you if you’re using Excel 2013 and you drag a datalabel somewhere.
