Greetings. I have a Pivot chart with 7 regions to choose from. I want the chart title to display the regions that are checked in the drop down on the pivot chart. I wrote this code but it will only works correctly if one region is checked. If two or more are checked, of the possible seven, it still only shows one. Any help would be appreciated.
Code:
Sub TitleRegion()
Dim PI As PivotItem
Dim mytitle As String
For Each PI In ActiveChart.PivotLayout.PivotTable.PivotFields("Region").PivotItems
If PI.Visible = True Then
mytitle = PI
End If
Next PI
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = mytitle & " Region"
End With
End Sub