Hi
I have a database that needs to be regularly updated and to prevent any duplication of records the codes need to do the following:
1. To delete the entire row if any duplicates in Column A (Employee ID)
2. To duplicate the first entry (Meaning if there was a duplicate of row 1 with row 15 it will delete row 1)
I have attach a copy of the excel in this link: Box
I have a database that needs to be regularly updated and to prevent any duplication of records the codes need to do the following:
1. To delete the entire row if any duplicates in Column A (Employee ID)
2. To duplicate the first entry (Meaning if there was a duplicate of row 1 with row 15 it will delete row 1)
I have attach a copy of the excel in this link: Box
VBA Code:
Sub RemoveDuplicateRows()
Dim MyRange As Range
Dim LastRow As Long
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Set MyRange = ActiveSheet.Range("A1:D" & LastRow)
MyRange.RemoveDuplicates Columns:=1, Header:=xlYes
End Sub