Goal:
- Search & Compare two Fields Column E (Sheet 2) to Column E (Sheet 1) Return duplicate Values from Sheet 2 to Sheet 3
- Show and Highlight Duplicates Highlight Values on Sheet 1 and 2
- Copy Duplicate Entries from Sheet 2, then Add to Sheet 3
If Column E(Sheet 2) = Column E(Sheet 1), then copy row(s) from (Sheet 2) and add to Sheet 3
I am trying to compare two excel sheets within a workbook. I want to find duplicate values between sheet 2 and 1 and highlight those values on both sheets. I understand this is a match or vlookup function, but the added layer is I would like to copy those values only from sheet 2 to sheet 3 for visual comparison. I have tried to create a Macro, But this was not helpful and I am in the process of trying to edit this;
Sub rowContent()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim i As Long, j As Long
Dim isMatch As Boolean
Dim newSheetPos As Integer
Set ws1 = ActiveWorkbook.Sheets("Sheet1")
Set ws2 = ActiveWorkbook.Sheets("Sheet2")
'Initial position of first element in sheet2
newSheetPos = ws2.Cells(ws2.Rows.Count, 1).End(xlUp).Row
For i = 1 To ws1.Cells(ws1.Rows.Count, 1).End(xlUp).Row
isMatch = False
For j = 1 To ws1.Cells(ws1.Rows.Count, 2).End(xlUp).Row
If ws1.Cells(i, 1).Value = ws1.Cells(j, 2).Value Then
ws1.Cells(j, 2).EntireRow.Copy ws2.Cells(newSheetPos, 1)
isMatch = True
newSheetPos = newSheetPos + 1
End If
Next j
If isMatch = False Then newSheetPos = newSheetPos + 1
Next i
End Sub
to work for my situation. Any help would be appreciated as I am no Excel Guru.
E1
on both sheets are the same? Or can a value in Sheet1, Col. E be anywhere in Sheet2 Column E? – BruceWayne