Delete Row IF

G

GregR

I have a table begining in Row 9 that I need to delete the entire row,
if any cell in Column "F" is =0 or if any cell in Column "J" begins
with "05" or "340". There are a dynamic number of rows in the table.
TIA

Greg
 
R

Rowan Drummond

Save your data before testing:

Sub delit()
Dim eRow As Long
Dim i As Long
eRow = Cells(Rows.Count, 6).End(xlUp).Row
For i = eRow To 9 Step -1
If Cells(i, 6).Value = 0 _
Or Left(Cells(i, 10).Value, 2) = "05" _
Or Left(Cells(i, 10).Value, 3) = "340" Then
Rows(i).EntireRow.Delete
End If
Next i
End Sub

Hope this helps
Rowan
 

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