comparing rows and deletion
With this data in the range A1:D4 then try:
Sub DelThem()
Dim i As Long
Dim j As Integer
Dim eRow As Long
Dim del As Boolean
eRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = eRow To 2 Step -1
For j = 1 To 4
If Cells(i, j).Value Cells(1, j).Value Then
del = True
Exit For
End If
Next j
If Not del Then Rows(i).EntireRow.Delete
Next i
End Sub
Hope this helps
Rowan
sreedhar wrote:
hi jim,
i have try changing the code to <=, = ,< but also it is not clearing
any rows even if it true.
i have try for rows
1 0 1 1
0 1 1 0
0 0 0 0
1 0 0 0
but the code is not clearing or deteleting any row.what i want is for
the above rows it should delete 3rd and 4th row because they are
lessthan and equal to every cell in 1st row.
2nd row can't be deleted because 2nd cell " 1 "geraterthan the 2nd cell
"0" of 1st row.
so ,plz help me
thanks
sree
|