My data set will vary in items. For example, the first data set will have JARS, BOTTLES, CUPS. The next time I run it, it might have JARS, BOTTLES, CUPS, JUGS. In both cases, I'd like the pivot table to show only JARS and BOTTLES. When I write the macro to create a pivot table, I am currently using:
With ActiveSheet.PivotTables("PivotTable6").PivotFields("Description")
.PivotItems("CUPS").Visible = False
.PivotItems("JUGS").Visible = False
The problem being, when the macro runs on data set 1 above, it will bomb out because there are no JUGS in the data set.
Is there a way to write it so that it will include JARS and BOTTLES rather than excluding CUPS and JUGS?
With ActiveSheet.PivotTables("PivotTable6").PivotFields("Description")
.PivotItems("CUPS").Visible = False
.PivotItems("JUGS").Visible = False
The problem being, when the macro runs on data set 1 above, it will bomb out because there are no JUGS in the data set.
Is there a way to write it so that it will include JARS and BOTTLES rather than excluding CUPS and JUGS?