I would like to extract all the data label if the refer to a range (Value From Cells) of the chart using VBA: so, it should give me something like Chart 1: Data label =Sheet1!$D$2:$D$11 Chart 2: Data label =Sheet1!$E$2:$E$11 Chart 3: Data label None
Sub GetDataLabelFormula()
Dim chartObj As ChartObject
Dim chartSeries As Series
Dim dataLabel As dataLabel
' Set the chart object and series
Set chartObj = ActiveSheet.ChartObjects("Chart 1")
Set chartSeries = chartObj.Chart.SeriesCollection(1)
' Set the data label
Set dataLabel = chartSeries.Points(1).dataLabel
' Retrieve the formula of the data label
Debug.Print dataLabel.formula
End Sub
But this return me the value instead