I have found the macro below from this forum but it leaves 1 of the duplicate rows within the searched sheet, so if I have 4 duplicates 1 remains and 3 move to the other sheet. Original url here
I am trying to move all duplicates within a column into a separate worksheet within the same workbook. Being new to VB I am struggling so any help welcomed.
I am trying to move all duplicates within a column into a separate worksheet within the same workbook. Being new to VB I am struggling so any help welcomed.
Code:
Sub CutDuplicates()
Dim Rng As Range, i As Long
Application.ScreenUpdating = False
Set Rng = Range("N2:N" & Range("N" & Rows.Count).End(xlUp).Row)
For i = Rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountIf(Rng, Cells(i, "N")) > 1 Then
LR = Sheets("Duplicates").Cells(Rows.Count, "N").End(xlUp).Row + 1
Rows(i).EntireRow.Cut Destination:=Sheets("Duplicates").Range("A" & LR)
Rows(i).EntireRow.Delete
End If
Next i
Application.ScreenUpdating = True
End Sub