phroureo
11-30-2015, 04:56 PM
Hello everyone, I have a unique need:
I need to be able to filter out a certain set of numbers (account numbers from a chart of accounts, if that helps). In this case, let's say I need to uncheck the "Filter" for "Accounts" if the account number is between 40000 and 60000.
I tried the following code:
'filters out the non-revenue accounts With ActiveSheet.PivotTables("PivotTable1").PivotFields("Account")
For i = 40000 To 60000
.PivotItems(i).Visible = False
Next i
End With
but it didn't work. I presume it's because there is not necessarily a value for every number between 40000 and 60000? Or is it because they are stored as text values in the filter field, and can't be compared to numbers?
I'm not sure that this problem has a solution, but any help would be much appreciated.
I need to be able to filter out a certain set of numbers (account numbers from a chart of accounts, if that helps). In this case, let's say I need to uncheck the "Filter" for "Accounts" if the account number is between 40000 and 60000.
I tried the following code:
'filters out the non-revenue accounts With ActiveSheet.PivotTables("PivotTable1").PivotFields("Account")
For i = 40000 To 60000
.PivotItems(i).Visible = False
Next i
End With
but it didn't work. I presume it's because there is not necessarily a value for every number between 40000 and 60000? Or is it because they are stored as text values in the filter field, and can't be compared to numbers?
I'm not sure that this problem has a solution, but any help would be much appreciated.