Sub Collect_Names_Series()
Dim Arr()
With ActiveSheet.ChartObjects(1).Chart 'name of the chart or indexnumber
cnt = .SeriesCollection.Count 'number of series
ReDim Arr(cnt, 1 To 6) 'redim the array
Arr(0, 1) = "name or range" 'headers for the array
Arr(0, 2) = "X-range"
Arr(0, 3) = "Y-range"
Arr(0, 4) = "Index-number"
Arr(0, 5) = "Name"
Arr(0, 6) = "Give here the new name !!!!"
For i = 1 To .SeriesCollection.Count
sp = Split(Replace(Replace(.SeriesCollection(i).Formula, "(", ","), ")", ","), ",") 'use the formula of the serie and split it on "(", ")" and ","
For j = 1 To 4: Arr(i, j) = sp(j): Next 'copy the relevant parts to the array
Arr(i, 5) = .SeriesCollection(i).Name 'the real content of the serie-name
Next
With Range("BA1").Resize(UBound(Arr) + 1, UBound(Arr, 2)) 'write array to this cell + as many rows as series (depends on the chart) and as many columns as in the array (6 now)
.Value = Arr
.EntireColumn.AutoFit
End With
End With
End Sub
Sub Rename_Series()
'run this macro after using previous macro and renaming the series in the column right to the column "Name"
Set c = Range("BA1") 'range("A1") is the same cell as in previous macro !!!!!!!!!!!!!!!!!!
With ActiveSheet.ChartObjects(1).Chart 'name of the chart or indexnumber
For i = 1 To .SeriesCollection.Count
If Len(c.Offset(i, 5).Value) > 0 And Len(c.Offset(i, 2).Value) > 0 Then .SeriesCollection(i).Name = c.Offset(i, 5).Value 'change only those series with something in the 3rd and the 6th column
Next
End With
End Sub