Finding duplicates in two worksheets

tf37

Board Regular
Joined
Apr 16, 2004
Messages
169
Finding duplicates in two worksheets
Rows A – H in both worksheets 1 & 2 all contain the same information
Sheet 1 has rows 1 – 14,700 records
Sheet 2 has rows 1 – 7001 records, all of which are included in sheet 1
Wish to find the duplicates in sheet 2 that are in sheet 1 and highlight those rows in sheet 1 (A-H preferred, but highlight the entire row ok too) yellow in

Then later able to sort those with yellow to bottom or top of the sort

Row headers are:
FirstName, MiddleInitial, LastName, Sex, DOB, HomePhone, Employment, WkPhone

Thank you gang. Years ago there was a similar post, but I can't seem to find any of my posts from years ago.
Terry
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Re: Help in finding duplicates in two worksheets

How about this for the 1st part
Code:
Sub FindDupes()
   Dim Ary As Variant
   Dim i As Long
   
   Ary = Sheets("Sheet2").Range("A1").CurrentRegion.value2
   With CreateObject("scripting.dictionary")
      For i = 2 To UBound(Ary)
         .Item(Join(Application.Index(Ary, i, 0), "|")) = Empty
      Next i
      Ary = Sheets("Sheet1").Range("A1").CurrentRegion.value2
      For i = 2 To UBound(Ary)
         If .exists(Join(Application.Index(Ary, i, 0), "|")) Then Sheets("Sheet1").Range("A" & i).Resize(, 8).Interior.Color = vbYellow
      Next i
   End With
End Sub
 
Upvote 0
Re: Help in finding duplicates in two worksheets

Thank you, I'll give it a try
 
Upvote 0
Re: Help in finding duplicates in two worksheets

That did work out just fine, thank you for the help :)
 
Upvote 0
Re: Help in finding duplicates in two worksheets

Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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