If Duplicate Copy


New Member
May 26, 2016
I have names in Col(A) and data in col(B:R). No duplicates in Col(A).
Col(B) are dates
Col(E:K) have data from 2017
Col(L:R) have data from 2016
I import new data (for 2017) to Col(Z:AG)
After processing new data, it's transfered to Col(A:K), last row + 1
Now I have many duplicates in Col(A) and some of the names from Col(Z) are new.
I want to do two things:
1. If there is a duplicate name in Col(A): copy oldest row, range(L:R) and paste it at newest row, range(L:R).
2. If there is a new name in Col(A): cells in range(L:R) = 0

I have struggle with this for a few days now but I can't get it to work
This is what I have so far:

Sub Macro1()

Dim Cell        As range
Dim MyData      As range
Dim LROW        As Long
Dim LstRow      As Long
Application.ScreenUpdating = False

LstRow = ActiveSheet.range("A" & Rows.Count).End(xlUp).Row
Set MyData = range("A5:A" & LstRow)

    For Each Cell In MyData
        If Evaluate("COUNTIF(" & MyData.Address & "," & Cell.Address & ")") > 1 Then
            LROW = cells(Rows.Count, "L").End(xlUp).Row
            range("L" & Cell.Row & ":R" & Cell.Row).Copy Destination:=range("L" & LROW + 1 & ":R" & LROW + 1)
        range("L" & LROW + 1 & ":R" & LROW + 1) = 0
        End If
    Next Cell
Application.ScreenUpdating = True
End Sub
Any help is much appreciated.
Thank you in advance.


New Member
May 26, 2016
Maybe I should add that all dates in Col(B) are older than today.
Only transfers from Col(Z:AG) have today's date in Col(B).

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...