How To Remove Filter In Excel Vba

To remove a filter in Excel VBA, you can use the following code:


Sub RemoveFilter()
    Sheets("Sheet1").AutoFilterMode = False
End Sub

Here’s the step-by-step explanation of the code:

  1. Sheets("Sheet1") refers to the sheet on which you want to remove the filter. Replace Sheet1 with the actual name of your sheet.
  2. AutoFilterMode is a property of the Worksheet object that determines whether a filter is applied on the sheet.
  3. Setting the AutoFilterMode property to False removes the filter from the sheet.

Here’s an example to remove a filter from the range A1:D10:


Sub RemoveFilter()
    Range("A1:D10").AutoFilter
End Sub

This code removes the filter from the range A1:D10.

Similar post

Leave a comment