Displaying items within pivot table fields

  • Thread starter Thread starter Gerald
  • Start date Start date
G

Gerald

Hi

Within a macro I've written I have the following syntax (which is not
working); at the time that the macro reaches this line of code only
the "ACCDNT" item in the "complaints_code" field within the
"ComplaintsTable" pivot table is being displayed:

With ActiveSheet.PivotTables("ComplaintsTable").PivotFields("complaint_code")
.PivotItems("ACCDNT").Visible = False
.PivotItems("ADVERSE").Visible = True
End With

Basically all I want to do is have the macro display the "ADVERSE"
item instead of the "ACCDNT" item, but it doesn't seem to want to work
the way I have it written. Any help very much appreciated

Thanks in advance
Gerald
 
try reversing the order - one item must always be visible

With
ActiveSheet.PivotTables("ComplaintsTable").PivotFields("complaint_code")
.PivotItems("ADVERSE").Visible = True
.PivotItems("ACCDNT").Visible = False
End With
 
Back
Top