Comparing Two Excel Sheets and copying like data to third
Closed
tyhipo
vcoolio
- Posts
- 2
- Registration date
- Friday June 23, 2017
- Status
- Member
- Last seen
- July 11, 2017
vcoolio
- Posts
- 1356
- Registration date
- Thursday July 24, 2014
- Status
- Moderator
- Last seen
- August 11, 2022
Related:
- Comparing Two Excel Sheets and copying like data to third
- Comparing Two Excel Sheets and copying like data to third sheet ✓ - Forum - Excel
- Compare two Excel sheets: and combine data - Guide
- How to compare two Excel sheets with varying data ✓ - Forum - Excel
- Compare two excel sheets and highlight differences macro ✓ - Forum - Excel
- Macro to compare 2 sheets and copy differences ✓ - Forum - Excel
3 replies
vcoolio
Jun 24, 2017 at 08:50 AM
- Posts
- 1356
- Registration date
- Thursday July 24, 2014
- Status
- Moderator
- Last seen
- August 11, 2022
Jun 24, 2017 at 08:50 AM
Hello Tyhipo,
Which code did you try? Could you please post it for us to examine.
Thank you.
vcoolio.
Which code did you try? Could you please post it for us to examine.
Thank you.
vcoolio.
tyhipo
Jul 11, 2017 at 02:40 PM
- Posts
- 2
- Registration date
- Friday June 23, 2017
- Status
- Member
- Last seen
- July 11, 2017
Jul 11, 2017 at 02:40 PM
Hi Vcoolio! Sorry it took me so long but here is what I used from the other answer solution.
Sub RunMe()
Dim lRow, x As Long
Sheets("Sheet1").Select
lRow = Range("C1").End(xlDown).Row
For Each cell In Range("C2:C" & lRow)
x = 2
Do
If cell.Value = Sheets("Sheet2").Cells(x, "E").Value Then
cell.EntireRow.Copy Sheets("Sheet3").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
x = x + 1
Loop Until IsEmpty(Sheets("Sheet2").Cells(x, "E"))
Next
End Sub
Sub RunMe()
Dim lRow, x As Long
Sheets("Sheet1").Select
lRow = Range("C1").End(xlDown).Row
For Each cell In Range("C2:C" & lRow)
x = 2
Do
If cell.Value = Sheets("Sheet2").Cells(x, "E").Value Then
cell.EntireRow.Copy Sheets("Sheet3").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
x = x + 1
Loop Until IsEmpty(Sheets("Sheet2").Cells(x, "E"))
Next
End Sub
vcoolio
Jul 13, 2017 at 06:29 AM
- Posts
- 1356
- Registration date
- Thursday July 24, 2014
- Status
- Moderator
- Last seen
- August 11, 2022
Jul 13, 2017 at 06:29 AM
Hello Tyhipo,
If you only want to copy rows with unique values in Column E (Sheet2), then try the following code:-
Run the code from Sheet2.
I hope that this helps.
Cheerio,
vcoolio.
If you only want to copy rows with unique values in Column E (Sheet2), then try the following code:-
Sub TryAgain() Dim lr As Long Dim fValue As Range lr = Range("A" & Rows.Count).End(xlUp).Row For Each cell In Sheet2.Range("E2:E" & lr) Set fValue = Sheet1.Columns("A:A").Find(cell.Value) If fValue Is Nothing Then GoTo NextCell If cell.Value = fValue.Value Then cell.EntireRow.Copy Sheet3.Range("A" & Rows.Count).End(3)(2) End If NextCell: Next cell Sheet3.Select End Sub
Run the code from Sheet2.
I hope that this helps.
Cheerio,
vcoolio.