Say that I have a pivot table and I want my filter to just show the items I want. I cannot stick to a certain value such as item1 and item7 to be false because it may be present or not present but the items2,3,4,5,7 are the data I want to be always present.
Is there and if else statement I could do where in if pivotitems = items2 or item3 or item4 and so on then
.pivotItems.Visible = true
else
.pivotItems.Visble = False
Is there and if else statement I could do where in if pivotitems = items2 or item3 or item4 and so on then
.pivotItems.Visible = true
else
.pivotItems.Visble = False
Code:
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("BTN"), "Count of BTN", xlCount
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Owner")
.PivotItems("item2").Visible = True
.PivotItems("item3").Visible = True
.PivotItems("item4").Visible = True
.PivotItems("item5").Visible = True
.PivotItems("item7").Visible = True
End With