Consulting

Results 1 to 4 of 4

Thread: Copy duplicate instead of deleting

  1. #1

    Copy duplicate instead of deleting

    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.

    [vba]
    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
    [/vba]
    Last edited by Bob Phillips; 11-08-2010 at 01:57 AM. Reason: Added VBA Tags

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You would change

    [vba]

    Range("A" & x).EntireRow.Delete
    [/vba]

    to

    [vba]

    Rows(x).Copy
    [/vba]

    but where would you copy it to?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    Copy duplicate instead of deleting

    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.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Know what?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •