title: Looping through report filters to change visibility doesn't work
body: <p>I'm trying to select one report filter, in this case Canada. That means the rest must be made invisible.
  This code works without issue:</p>
  
  <pre><code>Public Sub FilterPivotTable()
  
      With ActiveSheet.PivotTables("Epidemiology").PivotFields("COUNTRY")
  
          .PivotItems("Canada").Visible = True
          .PivotItems("USA").Visible = False
          .PivotItems("Germany").Visible = False
          .PivotItems("France").Visible = False
  
      End With
  
  End Sub
  </code></pre>
  
  <p>However, I'm trying to prepare for when we add other countries to our "Epidemiology" pivot table, so I tried to have a for loop. This code doesn't work:</p>
  
  <pre><code>With ActiveSheet.PivotTables("Epidemiology").PivotFields("COUNTRY")
  
      .PivotItems("Canada").Visible = True
  
      For Each Pi In .PivotItems
          If Pi.Value = "CANADA" Then
              Pi.Visible = True
          Else
              Pi.Visible = False
          End If
      Next Pi
  
  End With
  </code></pre>
  
  <p>It gives me an error on the <code>Pi.Visible = False</code> line. The error that I get is <code>Run-time error '1004': Unable to set the Visible property of the PivotItem class</code></p>
  
  <p>Why doesn't it work inside a for loop?!</p>
  
  <p>Frustratingly, all the examples I find online use similar syntax. (Some use an index, but I tried that and got the same error.)</p>