• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 48
  • Last Modified:

Like Autofilter

Hi,

I have some code that filters out anything like "Bulk Upload" and deletes the lines

   ActiveSheet.Range("A1:Q1").AutoFilter
     ActiveSheet.Range(Range("A1"), Range("C" & Rows.Count).End(xlUp)).AutoFilter Field:=3, _
        Criteria1:=Array("*Bulk Upload*"), Operator:=xlFilterValues

   ActiveSheet.Range(Range("C2"), Range("C" & Rows.Count).End(xlUp)).SpecialCells(xlVisible).EntireRow.Delete Shift:=xlUp
   ActiveSheet.Range("A1:Q1").AutoFilter

Open in new window


The problem is i have entries coming through that i need to keep - namely

"PCM ASP BB Clients Bulk Upload"

So all the other lines that contain Bulk Upload need to be deleted but the above needs to stay.

Can i say delete anything that is like "Bulk upload" except

"PCM ASP BB Clients Bulk Upload"


Many thanks!
0
Seamus2626
Asked:
Seamus2626
1 Solution
 
Saurabh Singh TeotiaCommented:
Use this code...

 ActiveSheet.Range("A1:Q1").AutoFilter
     ActiveSheet.Range(Range("A1"), Range("C" & Rows.Count).End(xlUp)).AutoFilter Field:=3, _
        Criteria1:=Array("*Bulk Upload*"), Operator:=xlAnd, Criteria2:="<>PCM ASP BB Clients Bulk Upload", Operator:=xlFilterValues

   ActiveSheet.Range(Range("C2"), Range("C" & Rows.Count).End(xlUp)).SpecialCells(xlVisible).EntireRow.Delete Shift:=xlUp
   ActiveSheet.Range("A1:Q1").AutoFilter

Open in new window


Saurabh...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now