Delete Rows Not Meeting Criteria

  • How can I automatically find and delete rows with cells that DO NOT meet multiple text criteria with a macro or VBA code? In other words, my data includes 2 columns of names and a header row. There are many names (20+) but I only need to keep the rows that have any one of 5 names in either of the 2 columns.

  • Re: Delete Rows Not Meeting Criteria

    Are the 5 names static or do they need to change?

    If they are static, you could set up a named range and then use a formula to check the columns.

    You could use a working column and a formula to indicate which rows to keep.

    So if your names are in column A & B list your desired names in J1-J5

    then use the following formula in Col C:


    This could be copied down Either manually or via vba, then sort the list and remove any lines with a "N" in col C

    You can do it via vba as follows:

Participate now!

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