VBA to filter multiple pivot filters and pivot filter items

nadiapatrick7580

New Member
Joined
Nov 25, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a pivot table in a worksheet called "MTD Payments" and the Pivot table is named "MTD PYMNT". The pivot table has 3 filters named "Gross Revenue", "ActualInsurancePayments", and "TotalAccountBalance". The first two filters requires that I clear the filters and then re-filter excluding 0's and I've managed to successfully do that using the VBA code below but the "TotalAccountBalance" filter has value ranges and I only need to include values between -5.00:+5.00. I am currently having trouble figuring this out.

Sub Button1_Click()

Dim GR As PivotField
Dim AIP As PivotField


Set PT = ThisWorkbook.Worksheets("MTD Payment").PivotTables("MTD PYMNT")
Set GR = PT.PivotFields("Gross Revenue")
Set AIP = PT.PivotFields("ActualInsurancePayments")

'//Reset Pivot Field Filter
GR.ClearAllFilters
AIP.ClearAllFilters

'//Enable Multiple Items Selection
GR.EnableMultiplePageItems = True
AIP.EnableMultiplePageItems = True

'//Select the Pivot Field Items
GR.PivotItems("0").Visible = False
AIP.PivotItems("0").Visible = False


Set GR = Nothing
Set AIP = Nothing
Set PT = Nothing


End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,215,777
Messages
6,126,838
Members
449,343
Latest member
DEWS2031

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