Hello,
I have a pivot with a filter with many numbers positive and negative value and i want a macro to filter then and check the negative value
i tried modifying the code here but not getting it.
I have a pivot with a filter with many numbers positive and negative value and i want a macro to filter then and check the negative value
i tried modifying the code here but not getting it.
Code:
Sheets("Tables").Select
Dim varItemList() As Variant
Dim pviItem As PivotItem
Dim i As Integer
Application.ScreenUpdating = False
varItemList = Array(-300)
varItemList2 = Array(-1)
' Loop through each item and compare the caption to the data in the array
For Each pviItem In Sheets("Tables").PivotTables("PivotTable2").PivotFields("TS").PivotItems
pviItem.Visible = True
For i = LBound(varItemList) To UBound(varItemList2)
If pviItem.Caption = varItemList(i) Then
pviItem.Visible = True
End If
Next i
DoEvents
Next pviItem
Application.ScreenUpdating = True
Sheets("Main Page").Select
End Sub