PDA

View Full Version : Copy duplicate instead of deleting



josef
11-07-2010, 10:53 PM
I have found this code here , i would like to know is it possible to copy entire row instead of deleting ?I am new to vba ,can someone help me please .thank you.


Sub DeleteDups()

Dim x AsLong
Dim LastRow AsLong

LastRow = Range("A65536").End(xlUp).Row
For x = LastRow To 1 Step -1
If Application.WorksheetFunction.CountIf(Range("A1:A" & x), Range("A" & x).Text) > 1 Then
Range("A" & x).EntireRow.Delete
EndIf
Next x

End Sub

Bob Phillips
11-08-2010, 01:54 AM
You would change



Range("A" & x).EntireRow.Delete


to



Rows(x).Copy


but where would you copy it to?

josef
11-10-2010, 03:12 AM
Thank you for your reply .It helped me a lot ,I can go forward with it now . I am trying to copy it in another sheet, being new i have to search online .if you let me know ,i shall be grateful to you .Thank you again for your help.

Bob Phillips
11-10-2010, 04:27 AM
Know what?