compare two coloum with other two coloum

aswathy0001

New member
Joined
Nov 29, 2016
Messages
24
Reaction score
0
Points
0
Location
india
Excel Version(s)
2010
compare two coloum with other two coloum if both exactly same i want to delete first coloumn

for example
A1= Name B1= Age
C1= Name D1= Age

i need if A and B is exactly same in then C and D (end of row) then that should Delete
how can i write a macro
can any one? please
 
Hi,
try
Code:
Sub deleteRow()Dim lR As Long, i As Long
    lR = Cells(Rows.Count, 1).End(xlUp).Row
    For i = lR To 1 Step -1
        If Cells(i, 1) & Cells(i, 2) = Cells(i, 3) & Cells(i, 4) Then
            Cells(i, 1).EntireRow.Delete
        End If
    Next i
End Sub
 
Back
Top