delete duplicated row help

Ks1102

Well-known Member
Joined
Jan 8, 2008
Messages
687
hi, all

How do I have delete the row if it are duplicated with sheet2 ??
Example
Sheet1. Range A2 and B2 and C2 value if same as sheet2 A2 & B2 & C2 then the rows deleted else … to down.
The spreadsheet sheet2 are too many data contents..

Can u help me create a code for me to clean sheet1 duplicated?


your help i highly appreciate
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
if condition match then you want to delete both sheet row or only one sheet ?
 
Upvote 0
try below code this code will check sheet1 A2 B2 And C2 Value To Sheet2 A2 , B2 And C2 If All Three Value are matched then it will delete that entire row from Sheet1 if you want something else then pls let me know
Code:
Sub Test()
Dim lr As Long
Sheets("Sheet1").Select
lr = Range("A" & Rows.Count).End(xlUp).Row
For i = lr To 2 Step -1
If Cells(i, 1) = Sheets("Sheet2").Cells(i, 1) And Cells(i, 2) = Sheets("Sheet2") _
.Cells(i, 2) And Cells(i, 3) = Sheets("Sheet2").Cells(i, 3) Then Cells(i, 1).EntireRow.Delete
Next i
End Sub
 
Upvote 0
try below code this code will check sheet1 A2 B2 And C2 Value To Sheet2 A2 , B2 And C2 If All Three Value are matched then it will delete that entire row from Sheet1 if you want something else then pls let me know
Code:
Sub Test()
Dim lr As Long
Sheets("Sheet1").Select
lr = Range("A" & Rows.Count).End(xlUp).Row
For i = lr To 2 Step -1
If Cells(i, 1) = Sheets("Sheet2").Cells(i, 1) And Cells(i, 2) = Sheets("Sheet2") _
.Cells(i, 2) And Cells(i, 3) = Sheets("Sheet2").Cells(i, 3) Then Cells(i, 1).EntireRow.Delete
Next i
End Sub

Thanks very much
 
Upvote 0

Forum statistics

Threads
1,203,400
Messages
6,055,179
Members
444,768
Latest member
EMGVT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top