Hello,
There's several examples of "remove duplicates" and "remove duplicate and delete row" and "remove duplicate and delete row/copy row to new sheet".
However, I want to remove all pairs that are duplicates to a new sheet. So if,
Originals Rows that contain:
Jane
Jane
John
Jack
Then "Remove" all Jane and keep rows with:
John
Jack
With new sheet of rows:
Jane
Jane
Below is a sample of code that shows up a lot for remove duplicates and move duplicates. but keeps all the "unique" rows.
There's several examples of "remove duplicates" and "remove duplicate and delete row" and "remove duplicate and delete row/copy row to new sheet".
However, I want to remove all pairs that are duplicates to a new sheet. So if,
Originals Rows that contain:
Jane
Jane
John
Jack
Then "Remove" all Jane and keep rows with:
John
Jack
With new sheet of rows:
Jane
Jane
Below is a sample of code that shows up a lot for remove duplicates and move duplicates. but keeps all the "unique" rows.
Code:
Sub CutDuplicates()
Dim xRgS As Range
Dim xRgD As Range
Dim I As Long, J As Long
On Error Resume Next
Set xRgS = Application.InputBox("Please select the column:", "Column", Selection.Address, , , , , 8)
If xRgS Is Nothing Then Exit Sub
Set xRgD = Application.InputBox("Please select a desitination cell (first cell of column):", "New Area. Cell only", , , , , , 8)
If xRgD Is Nothing Then Exit Sub
xRows = xRgS.Rows.Count
J = 0
For I = xRows To 1 Step -1
If Application.WorksheetFunction.CountIf(xRgS, xRgS(I)) > 1 Then
xRgS(I).EntireRow.Copy xRgD.Offset(J, 0)
xRgS(I).EntireRow.Delete
J = J + 1
End If
Next
End Sub