S
stanshoe
Here are two macros I RECORDED to collapse and expand the data viewed in a
pivot table.
Sub CollapseView()
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Status")
.PivotItems("C").Visible = False
.PivotItems("PA").Visible = False
.PivotItems("PE").Visible = False
.PivotItems("PU").Visible = False
.PivotItems("PX").Visible = False
End With
End Sub
Sub ExpandView()
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Status")
.PivotItems("C").Visible = True
.PivotItems("PA").Visible = True
.PivotItems("PE").Visible = True
.PivotItems("PU").Visible = True
.PivotItems("PX").Visible = True
End With
End Sub
Sub CollapseView works just fine. When I try to run ExpandView I get Error
Message 1004 - " Unable to set the Visible property of the PivotItem class."
I am not able to change any of the PivotItems with this code.
I do not understand why I can programtically set the visible property to
false but can't set it to true. This is the first time I have not been able
to run code that I recorded. Any ideas on what is happening here would be
much appreciated.
pivot table.
Sub CollapseView()
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Status")
.PivotItems("C").Visible = False
.PivotItems("PA").Visible = False
.PivotItems("PE").Visible = False
.PivotItems("PU").Visible = False
.PivotItems("PX").Visible = False
End With
End Sub
Sub ExpandView()
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Status")
.PivotItems("C").Visible = True
.PivotItems("PA").Visible = True
.PivotItems("PE").Visible = True
.PivotItems("PU").Visible = True
.PivotItems("PX").Visible = True
End With
End Sub
Sub CollapseView works just fine. When I try to run ExpandView I get Error
Message 1004 - " Unable to set the Visible property of the PivotItem class."
I am not able to change any of the PivotItems with this code.
I do not understand why I can programtically set the visible property to
false but can't set it to true. This is the first time I have not been able
to run code that I recorded. Any ideas on what is happening here would be
much appreciated.