Skip to content

Instantly share code, notes, and snippets.

@ateneva
Last active April 21, 2018 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateneva/6f75fa3dea68defe7ea406567a2b9d85 to your computer and use it in GitHub Desktop.
Save ateneva/6f75fa3dea68defe7ea406567a2b9d85 to your computer and use it in GitHub Desktop.
Keep Pivot Field source name (followed by a blank)
Sub AddDefaultName()
Dim Wks As Worksheet
Dim PT As PivotTable
Dim PF As PivotField
Dim Title As String
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'written by Angelina Teneva, September 2016
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each Wks In ActiveWorkbook.Worksheets
For Each PT In Wks.PivotTables
On Error Resume Next
For Each PF In PT.DataFields
Title = PF.SourceName & " "
PF.Caption = Title
Next PF
Next PT
Next Wks
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment