FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I have a drop down box with a Yes or No which calls the macro below to add data labels to my chart, not just the y and x value, but rather, value from cells. Of course the macro below is just for the Yes side of the drop down and that I have all done.
There is a named range for the values, but not getting the right syntax for adding the named range to the code below. Included is what I tried. But no luck.
Can somebody point me in the right direction?
There is a named range for the values, but not getting the right syntax for adding the named range to the code below. Included is what I tried. But no luck.
Code:
Sub Macro4()
' Dim rng As Range
' Set rng = Worksheets("Linest").Range("MyLabels")
ActiveChart.FullSeriesCollection(1).DataLabels.Select
' ActiveChart.SeriesCollection(1).DataLabels.Format.TextFrame2.TextRange.InsertChartField msoChartFieldRange, rng, 0
ActiveChart.SeriesCollection(1).DataLabels.Format.TextFrame2.TextRange.InsertChartField msoChartFieldRange, "=Linest!$BD$16:$BD$33", 0
Selection.ShowRange = True
Selection.ShowValue = False
Application.Goto [A1], Scroll:=True
End Sub
Can somebody point me in the right direction?