Pivot table reset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a pivot table and accidentally changed the names in my table for a particular field. How do I reset the field names back to the original name without starting over?
 
You can retype the captions, or use a macro, similar to the following:

'===============================
Sub ResetCaptions()
'retrieve original field names
'if captions have been typed into pt
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables(1)
For Each pf In pt.VisibleFields
For Each pi In pf.PivotItems
pi.Caption = pi.SourceName
Next pi
Next pf
pt.RefreshTable
End Sub
'============================
 
Back
Top