The following code allows the user to delete TextBoxes from a named chart.
To select a chart, the user has to enter the chart name in the macro.
In this example, the name is “Chart xyz”.
How do you build the code, so that the user can simply select a chart by clicking on it?
Sub DeleteTextBoxesFromASelectedChart()
Dim ChrtObj As ChartObject
On Error Resume Next
Set ChrtObj = ActiveSheet.ChartObjects("Chart xyz")
ChrtObj.Chart.TextBoxes.Delete
On Error GoTo 0
End Sub