Autofilter By Criteria

  • I have some table with data.
    I need to filter the data by criteria "inactive" in column B and then to delete all rows that fit criteria condition.

    The code is following:

    I understand that next row must be variable?


    May anybody to help.
    Thanks in advance.

  • Re: Autofilter By Criteria

    Try this without filtering

  • Re: Autofilter By Criteria

    or if you wanted an autofilter method. I assume column c is the last with data in. You may wish to change.

    Sub Macro1()
        Rows("1:1").AutoFilter Field:=2, Criteria1:="Inactive"
        Range("a1", Range("c65000").End(xlUp)).Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!