How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask ATLPROG Your Own Question
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7677
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
Type Your Programming Question Here...
ATLPROG is online now
A new question is answered every 9 seconds

I was hoping someone could please point me in the right

Customer Question

Good Evening, I was hoping someone could please point me in the right direction. I need to find the duplicates between two work sheets, both duplicates will be in column A. I then need to move the duplicate rows from sheet 1 to a separate sheet for duplicates. While completely removing them from sheet one, but leaving them on sheet 2. Any help would be greatly appreciated! This is what I have so far: Sub deletedups()
Dim S1 As Worksheet, S2 As Worksheet, lR1 As Long, lR2 As Long, _
dRws As Range, c As Range, n As Long
Set S1 = Sheets("Merged_NF")
Set S2 = Sheets("JHMO_NF")
lR1 = S1.Range("A" & Rows.Count).End(xlUp).Row
lR2 = S2.Range("A" & Rows.Count).End(xlUp).Row
For Each c In S1.Range("A1", "A" & lR1)
If Not IsEmpty(c) Then
n = 0
On Error Resume Next
n = Application.Match(c.Value, S2.Range("A2", "A" & lR2), 0)
On Error GoTo 0
If n > 0 Then
If Not dRws Is Nothing Then
Set dRws = c.EntireRow
End If
End If
End If
Next c
If Not dRws Is Nothing Then dRws.Delete
End Sub'
Submitted: 1 year ago.
Category: Programming
Expert:  The-PC-Guy replied 1 year ago.

this can be done kind of easily, I would do this a different way though.

Can you send an example sheet, or would you prefer I just send some code?