Clears all filters in PivotTable and hide the [blank] item from list, pass workbook, sheet and pivottable name
Function ANmaPivotTable_Clear(PvTName, Optional Shee = "Active", Optional WB = "This")
' clears all filters in PivotTable and hide the [blank] item from list
' PvTName = PivotTable Name in Excel
If WB = "This" Then WB = ThisWorkbook.Name
If WB = "Active" Then WB = ActiveWorkbook.Name
If Shee = "Active" Then Shee = ActiveSheet.Name
workbooks(WB).Worksheets(Shee).PivotTables(PvTName).PivotFields(1).ClearAllFilters
With WOrkbooks(WB).Worksheets(Shee).PivotTables(PvTName).PivotFields(1)
.PivotItems("").Visible = False
End With
End Function
' From WWR system
' Sub Macro5()
' ' clears all filters in PivotTable and hide the [blank] item from list
' Range("AF29").Select
' ActiveSheet.PivotTables("G&A").PivotFields("Company Ticker").ClearAllFilters
' With ActiveSheet.PivotTables("G&A").PivotFields("Company Ticker")
' .PivotItems("").Visible = False
' End With
'End Sub
' clears all filters in PivotTable and hide the [blank] item from list
' PvTName = PivotTable Name in Excel
If WB = "This" Then WB = ThisWorkbook.Name
If WB = "Active" Then WB = ActiveWorkbook.Name
If Shee = "Active" Then Shee = ActiveSheet.Name
workbooks(WB).Worksheets(Shee).PivotTables(PvTName).PivotFields(1).ClearAllFilters
With WOrkbooks(WB).Worksheets(Shee).PivotTables(PvTName).PivotFields(1)
.PivotItems("").Visible = False
End With
End Function
' From WWR system
' Sub Macro5()
' ' clears all filters in PivotTable and hide the [blank] item from list
' Range("AF29").Select
' ActiveSheet.PivotTables("G&A").PivotFields("Company Ticker").ClearAllFilters
' With ActiveSheet.PivotTables("G&A").PivotFields("Company Ticker")
' .PivotItems("").Visible = False
' End With
'End Sub
PvTName, Optional Shee = "Active", Optional WB = "This"
Views 140
Downloads 57
CodeID
DB ID