title: Remove filters from ALL Excel Tables VBA
body: <p>I am creating some Excel Add-ins to complete some basic tasks for our users. We have a spreadsheet that is provided to our users for each of our projects. They use these spreadsheets to make changes to configurable items prior to us processing a conversion to an SQL database. When they complete the spreadsheet, often times they forget to unhide rows, columns, and/or remove filters. I would like to create a macro that can be run to Unhide Rows/Columns from each worksheet and to clear filters from each ListObject. Here is the code I was attempting to use:</p>
  
  <pre><code>Sub RemoveFiltersUnhide()
      Dim i As Long
  
      Application.ScreenUpdating = False
  
      For i = 1 To ThisWorkbook.Worksheets.Count
          ThisWorkbook.Worksheets(i).AutoFilterMode = False
          ThisWorkbook.Worksheets(i).Rows.Hidden = False
          ThisWorkbook.Worksheets(i).Columns.Hidden = False
      Next i
  
      Application.ScreenUpdating = True
  End Sub
  </code></pre>
  
  <p>The code works to Unhide Rows/Columns on each sheet, but it does not clear filters. Since each provided workbook will be different and will not contain the same worksheets or listobjects, I do not know how to go about looping through each table. Anyone have any thoughts on how I can approach this?</p>
  
  <hr>
  
  <p>Working VBA:</p>
  
  <pre><code>Sub RemoveFiltersUnhide()
      Dim ws As Worksheet, lo As ListObject
  
      Application.ScreenUpdating = False
  
      For Each ws In ThisWorkbook.Worksheets
          ws.Rows.Hidden = False
          ws.Columns.Hidden = False
  
          For Each lo In ws.ListObjects
              lo.AutoFilter.ShowAllData
          Next
      Next
  
      Application.ScreenUpdating = True
  End Sub
  </code></pre>