Using Excel 2010
I have a chart created from a pivot table and using a slicer. Would like the chart title to change when a slicer item is selected and even if multiple items are selected. The following is code I have found but it errors out at
.ChartTitle.Text = s(n) & Chr(13) & s(n + 2)

Example code:

Sub SlicerTitle()
Dim slc As SlicerItems
Dim sli As SlicerItem
Dim s As Variant
Dim n As Integer
ReDim s(4)
For n = 1 To 4
Set slc = ActiveWorkbook.SlicerCaches(n).SlicerItems
For Each sli In slc
If sli.Selected Then
s(n) = s(n) & ", " & sli.Name
End If
Next sli
s(n) = Right(s(n), Len(s(n)) - 2)
Next n
For n = 1 To 2
With Sheets("Chart_" & n)
.ChartTitle.Text = s(n) & Chr(13) & s(n + 2)
End With
Next n
End Sub

Would also like this to work on just the active worksheet.

Thanks