View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hal Hal is offline
external usenet poster
 
Posts: 36
Default For Each Next, Case Select

I would like to get the code below to work by looking for each PivotItem and
if it exists, set the Visible property to False. I've tried to nest a Case
Select within a For Each loop but I can not get this to work for me.

Any and all help is greatly appreciated.



With ActiveSheet.PivotTables("PivotTable1").PivotFields ("ENGINE STATUS")
.PivotItems("IN-SP").Visible = False
.PivotItems("SA-FA").Visible = False
.PivotItems("SD-WF").Visible = False
.PivotItems("SD-WR").Visible = False
.PivotItems("TS367-094").Visible = False
.PivotItems("TS367-096").Visible = False
.PivotItems("TS-DP").Visible = False
.PivotItems("TS-FA").Visible = False
.PivotItems("TS-SA").Visible = False
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("ENGINE STATUS")
.PivotItems("LD-RV").Visible = False
.PivotItems("TS367-092").Visible = False
.PivotItems("TS-DP").Visible = False
.PivotItems("TS-EN").Visible = False
.PivotItems("TS-FA").Visible = False
End With