djsmarties
Board Regular
- Joined
- Sep 10, 2002
- Messages
- 95
Hi,
I tried creating a macro that would "reset" a pivot table field to show all items in the list (just clicked on the "show all" button).
With ActiveSheet.PivotTables("PivotTable1").PivotFields("grouping")
.PivotItems("4-5 days").Visible = True
.PivotItems("6-7 days").Visible = True
.PivotItems("8-10 days").Visible = True
End With
The problem is that there isnt data for every list item in the pivot table and when I run the macro I get an error message:
"Unable to set the Visible property of the PivotItem class"
I think this is because it is trying to show data for "6-7 days" but currently there is no data for this list item.
Is there any (other) way a pivot table can be reset to "show all" with VBA code?
Thanks a lot
I tried creating a macro that would "reset" a pivot table field to show all items in the list (just clicked on the "show all" button).
With ActiveSheet.PivotTables("PivotTable1").PivotFields("grouping")
.PivotItems("4-5 days").Visible = True
.PivotItems("6-7 days").Visible = True
.PivotItems("8-10 days").Visible = True
End With
The problem is that there isnt data for every list item in the pivot table and when I run the macro I get an error message:
"Unable to set the Visible property of the PivotItem class"
I think this is because it is trying to show data for "6-7 days" but currently there is no data for this list item.
Is there any (other) way a pivot table can be reset to "show all" with VBA code?
Thanks a lot