I get an error here:
Please help
Code:
For Each pi In Worksheets("Pivot").PivotTables("pivottable1").PivotFields("Name of Person")
Code:
Sub macro_214431()
Dim pt As PivotTables
Dim pi As PivotItems
Dim pf As PivotFields
Worksheets("Pivot").PivotTables("pivottable1").ManualUpdate = True
With Worksheets("Pivot").PivotTables("pivottable1").PivotFields("name of Person")
For Each pi In Worksheets("Pivot").PivotTables("pivottable1").PivotFields("Name of Person")
If pi(i).Visible = True Then
ActiveSheet.Rows("1:2").Insert Shift:=xlDown
Cells(1, 1).Value = "Name:" & "," & pi(i)
Cells(1, 1).FontSize = 13
Cells(1, 1).Font.Bold = True
Range("A1:d1").HorizontalAlignment = xlCenterAcrossSelection
.PrintTitleRows = "$1:$6"
End If
Next pi
End With