title: excel macro vba Filtering using wildcards
body: <p>I need to filter in pivot.
  I need to deselect all items starting with "A." and "H."
  and keep everything else selected.</p>
  
  <p>the items ranges from:
  A.(3-13 characters)
  B.(3-13 characters)
  all the way to 
  Z.(3-13 characters)</p>
  
  <p>the raw data also changes from 50-500 rows (I can have a data with only 50 rows today - then tomorrow I may have over 500)</p>
  
  <p>my current code works: (by entering all possible items which appears on that column - roughly over 300 items) its long but it works.
  lately I've been getting more items adding to that list, and I know we can use wild cards.</p>
  
  <pre><code>[MY CURRENT CODE]
      ActiveSheet.PivotTables("PivotTable1").PivotFields("column").ClearAllFilters
      ActiveSheet.PivotTables("PivotTable1").PivotFields("column"). _
          EnableMultiplePageItems = False
      With ActiveSheet.PivotTables("PivotTable1").PivotFields("column")
      .PivotItems(" PLACE ITEM HERE ").Visible = False
      .PivotItems
      .PivotItems
      .PivotItems [repeat over 300 times - changing the " PLACE ITEM HERE " with the items on the column]
      End With
  </code></pre>
  
  <p>I can cut down the 300+ lines to about 5-10 lines only, I was thinking about something like (below) it would also fix my problem of having new items that are not yet on my list:</p>
  
  <pre><code>ActiveSheet.PivotTables("PivotTable1").PivotFields("column").ClearAllFilters
          ActiveSheet.PivotTables("PivotTable1").PivotFields("column"). _
          EnableMultiplePageItems = False
      With ActiveSheet.PivotTables("PivotTable1").PivotFields("column")
      .PivotItems("A.*").Visible = False
      .PivotItems("H.*").Visible = False
      End With
  </code></pre>
  
  <p>but this is not working</p>