Pivot table reset

M

MJH

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?
 
D

Debra Dalgleish

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
'============================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top