Conditional Row Delete

  • Thread starter Thread starter Sparky
  • Start date Start date
S

Sparky

I have a large worksheet that I must modify on a semi-annual basis.

One of the mods requires the deletion of Rows where a cell in the
row meets a criteria. For example: Cell "E" within the Row contains
"2XL" then I want to delete the entire row and move to the next row.

Thanks for any help.
 
Sub AAA()
Dim rng As Range, rng1 As Range
Set rng = Range(Cells(1, "E"), Cells(Rows.Count, "E"))
Set rng1 = rng.Find("2XL")
If Not rng1 Is Nothing Then
Do
rng1.EntireRow.Delete
Set rng1 = rng.Find("2XL")
Loop While Not rng1 Is Nothing
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top