• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Keep certain rows, Delete others

jassybun

Member
I run the current macro in my report to keep all departments that are coded 76, 82 or 85. This macro takes out thousands of rows, which is perfect. Then I run another macro that adds department names based on a lookup list (not included). Now I need ta 3rd macro to go back and delete some more rows based on that new column, "automotive" and the code "85". Example of data is in the "NEW" tab.

It is not easy to alter this code because the code was written based on the last column, and since the last column has changed I am not sure how to go about it.

Any help is greatly appreciated!!!

Thank you
 

Attachments

Fluff13

Member
How about
Code:
Sub jassybun()
   With Sheets("New")
      If .AutoFilterMode Then .AutoFilterMode = False
      .Range("A1").AutoFilter 6, 85
      .Range("A1").AutoFilter 7, "<>Automotive"
      .AutoFilter.Range.Offset(1).EntireRow.Delete
      .AutoFilterMode = False
   End With
End Sub
 
Top