Find and Delete Row

K

Keyrookie

Need some help...

I'm trying to find ANY text in a column and then delete the entire row.
In other words, if there is text in B3, B8, B16, etc., I want to find
the macro to find it and then delete the rows 3, 8, 16, etc. These are
not actual rows, just examples. I tried the following macro but it
doesn't work. I tried to use a wildcard character to locate text in
column B because that text is not a constant. I think I'm close but I
need this to be corrected.

Thanks for your help.

Sub Delete_Zero_Rows()
Dim lastrow As Long, r As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For r = lastrow To 1 Step -1
If Cells(r, "B") = (item*) Then
Rows(r).EntireRow.Delete
End If
Next r
End Sub
 
G

Guest

Sub Delete_Zero_Rows()
Dim lastrow As Long, r As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For r = lastrow To 1 Step -1
If Application.WorksheetFunction.IsText(Cells(r, "B")) Then
Rows(r).EntireRow.Delete
End If
Next r
End Sub
 

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

Top