Hi guys,
I have a problem with my pivot table. What I am trying to do is create a userform that allows people to input up to five customer IDs and then format the pivot table accordingly.
I have been able to hide all pivot items, but making the requested items seems to be more problematic. The following code does work:
With ActiveSheet.PivotTables("PivotTable4").PivotFields("Sold-to Party")
.PivotItems("1234567").Visible = True
End With
It succesfully make customer "1234567" visible. But when I try to do it by using the variable from the userform the code gives me the '1004' error. This is the code:
Public ComboBox1 As Integer
With ActiveSheet.PivotTables("PivotTable4").PivotFields("Sold-to Party")
.PivotItems(ComboBox1).Visible = True
End With
Anyone have an idea why it doesn't work like this?
Bookmarks