VBA Pivot filter

Vladgs

New Member
Joined
Nov 26, 2015
Messages
45
Hi everyone!

I really need some help on VBA pivot filtering.

I am trying to exclude "1099" and " *Address* " from a pivot filter called "Vendor_site_code".

Also very important, i need to clear all filters before I reapply them.

what I have so far works only for the first filter of the pivot excluding some names:

Code:
Sub Pay_site_is_no()


    ActiveSheet.PivotTables("PivotTable10").PivotFields("VENDOR_name").ClearAllFilters
    
    
    With ActiveSheet.PivotTables("PivotTable10").PivotFields("VENDOR_name")
        .PivotItems("aff").Visible = False
        .PivotItems("wex").Visible = False
        .PivotItems("inc").Visible = False
    End With
    
End Sub

I've tried the below code also, but it says "Unable to get pivot items propriety of the pivot field class" Any ideea what I'm doing wrong ?

Code:
ActiveSheet.PivotTables("PivotTable10").PivotFields("VENDOR_site_code").ClearAllFilters
    
    
    With ActiveSheet.PivotTables("PivotTable10").PivotFields("VENDOR_site_code")
        .PivotItems("1099").Visible = False
        .PivotItems("*Address*").Visible = False
    End With
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,215,343
Messages
6,124,398
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top