Empty Pivot Field using a Macro

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

Guest

although I tried a couple of options, I do not seem to sucseed in making a
macro which actualy empties the PivotField as I want to.

I tried:
ActiveSheet.PivotTables("PivotTable3").PivotFields("Count of Uren"). _
Orientation = xlHidden

But as the pivot Field is not always "Count of Uren", the macro Bug's as
soon as the PivotField is filled with something else.

Who knows how I can make this work? Thanks in Advance!
 
To clear all the pivot table's data fields:

'=========================
Sub RemoveDataFields()
Dim pt As PivotTable
Dim pf As PivotField
Set pt = ActiveSheet.PivotTables(1)

For Each pf In pt.DataFields
pf.Orientation = xlHidden
Next pf

End Sub
'==========================
 
Back
Top