Hi,
The below codes works very slow and hangs finally not responding, some one help me to make faster for 3,00,000 rows. Or alternate script to achieve the result.
Search the duplicates entries in column A and its original row moved to Sheet2.
Option Explicit
Sub CUT_Dupes_New_Sheet()
On Error GoTo ErrHandler
Dim myDataRng As Range, myCutRng As Range
Dim c As Range, cc As Range
Dim lCol As Long
Set myDataRng = Range("A2:A" & Cells(Rows.Count, "I").End(xlUp).Row)
Application.ScreenUpdating = False
For Each c In myDataRng
If Application.Evaluate("COUNTIF(" & myDataRng.Address & "," & c.Address & ")") > 1 Then
lCol = Cells(c.Row, Columns.Count).End(xlToLeft).Column
c.Offset(, 17) = "xx"
End If
Next c
Set myCutRng = Range("R2:R" & Cells(Rows.Count, "I").End(xlUp).Row)
For Each cc In myCutRng
If cc = "xx" Then
cc.Offset(, -17).Resize(1, 17).Cut Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2)
End If
Next cc
Set myDataRng = Nothing
Range("R:R").ClearContents
ErrHandler:
Application.ScreenUpdating = True
End Sub
Posted at windowssecrets.com