title: Excel 2013 VBA clear active filter
body: <p>I need to clear any active filters from a sheet before running a certain macro, this line works just fine IF there is an active filter on</p>
  
  <pre><code>If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData
  </code></pre>
  
  <p>However if no filters are selected it returns the error</p>
  
  <pre><code>Runtime error '1004';
  ShowAllData method of Worksheet class failed
  </code></pre>
  
  <p>I got that code from an answer to this question
  <a href="https://stackoverflow.com/questions/21761027/excel-2013-vba-clear-all-filters-macro">Excel 2013 VBA Clear All Filters macro</a></p>
  
  <p>However that question doesn't explain how to ignore the line if no filters are active.</p>
  
  <p>How do I ignore this line if there are no currently active filters applied?</p>
  
  <p>EDIT</p>
  
  <p>For example, all column headings have been auto filtered, so if my sheet is filtered by 'Female' for example I need to remove that filter before running the macro, however if no filters have been applied, just run the macro as normal</p>