In Excel I have been able to filter the row labels in a pivot table with this code:
Dim PT as PivotTable
Set PT = ActiveSheet.PivotTables("Pivot1")
With PT
.ManualUpdate=True
.ClearAllFiters
.PivotFields("App").PivotFilters.Add Type:=xlCaptionDoesNotContain, Value1:="(Blank)"
End With
I need to do the same filter for the column labels where my field name is Type.
I tired this:
Dim PT as PivotTable
Set PT = ActiveSheet.PivotTables("Pivot1")
With PT
.ManualUpdate=True
.ClearAllFiters
.PivotFields("App").PivotFilters.Add Type:=xlCaptionDoesNotContain, Value1:="(Blank)"
.PivotFields("Type").PivotFilters.Add Type:=xlCaptionDoesNotContain, Value1:="(Blank)"
End With
However I get an error, "unable to get the PivotFields property of the PivotTable class" when it hits the below line:
.PivotFields("Type").PivotFilters.Add Type:=xlCaptionDoesNotContain, Value1:="(Blank)"
What syntax do I use to filter the column label?