View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 380
Default VB Delete rows that do not match criteria

For i = Cells(Rows.Count,"D").End(xlUp).Row To 2 Step -1
If Cells(i,"D").Value < Range("D2").Value Then
Rows(i).Delete
End If
Next i

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"rlee1999" wrote in message
...
I need to paste data into a template sheet. The data is never more than

2000
rows. If the data being pasted is only 1000 rows I need check the entire

2000
rows in Col D against the value in D2. If D? does not match D2 I need that
row to be deleted... Any suggestions?