A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
I know the answer. Remove " " from the number 0 & 4. Else it is treated as text not number.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I use Record Macro to filter PivotTable "PR to PO Days" field label filter between 0 and 4. When i record, it can filter correctly, only show 1, 2 & 4. But when i run the macro, it is not filter correctly, 24 which is should not show always show.
Hope can get help. Thank you!
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
I know the answer. Remove " " from the number 0 & 4. Else it is treated as text not number.
Thank you for your help. Because i want to modify the coding the values filter in between are variable (numbers key in by users at cells). So i cannot know what's the values are to filter.
Hi,
try this....
Sub Macro20_new ()
' ### 13 Mar 2019 ###
Dim pi As PivotItem
ActiveSheet.PivotTables("PivotTableMacro4").PivotFields("PR to PO Days").ClearAllFilters
For Each pi In ActiveSheet.PivotTables("PivotTableMacro4").PivotFields("PR to PO Days").PivotItems
Select Case pi
Case "0", "1", "2", "3", "4"
Case Else
pi.Visible = False
End Select
Next pi
End Sub