Last active
April 21, 2018 14:52
-
-
Save ateneva/cb7af2fd9bbb4ba7b8278357d90d0fb1 to your computer and use it in GitHub Desktop.
Chnage Pivot Field default name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ChangeDefaultPFName() | |
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.name | |
'comment out the line(s) that you do not need | |
PF.name = Mid(Title, 8, Len(Title) - 7) & " " 'removes the "sum of", "max of", "min of" | |
PF.name = Mid(Title, 10, Len(Title) - 9) & " " 'removes the "count of" | |
PF.name = Mid(Title, 12, Len(Title) - 11) & " " 'removes the "average of", "product of" | |
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