View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Aaron Aaron is offline
external usenet poster
 
Posts: 287
Default Delete Row if value <

I have the following code that should delete any row that doesn't have the
value of Defective in my range but it is deleting everything. Please help.

lastrow = Cells(Rows.Count, "A").End(xlUp).Row

For Each c In ActiveSheet.Range("C2:C" & lastrow)
If c.Value = "DEFECTIVE" Then
Else
Selection.EntireRow.delete
End If
Next

Thanks in advance, Aaron