(Solved) – Using VBA to set legend entry titles to series titles

  • by

Using VBA, I’m hoping to rename legend entries to their corresponding series titles. In the included picture, I want “Series 1” and “Series 2” to be replaced with “pbx” and “alt”. I recorded a macro to learn how to do individually but would like to create a loop to avoid specifically referencing each series title (e.g. If I added a series title at D1 and E1, the legend would automatically include the new titles.

ActiveChart.FullSeriesCollection(1).Name = “=Sheet1!$B$1”

ActiveChart.FullSeriesCollection(2).Name = “=Sheet1!$C$1”

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *