nadiapatrick7580
New Member
- Joined
- Nov 25, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- 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
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