Comparing Excel sheets with only a few overlapping records
Closed
lynn.frances
Posts
1
Registration date
Monday January 26, 2015
Status
Member
Last seen
January 26, 2015
-
Jan 26, 2015 at 05:40 PM
RayH Posts 122 Registration date Tuesday August 31, 2010 Status Contributor Last seen June 20, 2016 - Jan 26, 2015 at 08:05 PM
RayH Posts 122 Registration date Tuesday August 31, 2010 Status Contributor Last seen June 20, 2016 - Jan 26, 2015 at 08:05 PM
Related:
- Comparing Excel sheets with only a few overlapping records
- Mark sheet in excel - Guide
- Sheets right to left - Guide
- How to open excel sheet in notepad++ - Guide
- Number to words in excel - Guide
- Excel apk for pc - Download - Spreadsheets
1 response
RayH
Posts
122
Registration date
Tuesday August 31, 2010
Status
Contributor
Last seen
June 20, 2016
26
Jan 26, 2015 at 08:05 PM
Jan 26, 2015 at 08:05 PM
This is based on code I wrote the other day for another question but with a few minor changes.
Sub FindDupes()
Dim lastRow1 As Long, lastRow2 As Long
Sheet1.Select
lastRow1 = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
lastRow2 = Sheet2.Range("A" & Rows.Count).End(xlUp).Row
For Each cell In Sheet2.Range("A2:A" & lastRow2)
On Error Resume Next
r = Rows(Application.Match(cell.Value, Sheet1.Range("A2:A" & lastRow1), 0)).Row
If Err.Number = 0 Then
cell.Copy Sheet3.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next
Sheet3.Select
End Sub