Results 1 to 6 of 6

Copy/Paste Remove Duplicates

Threaded View

  1. #1
    Registered User
    Join Date
    10-22-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    80

    Cool Copy/Paste Remove Duplicates

    Hi all again. I need help on the following code

    Private Sub CommandButton2_Click()
        Workbooks.Open ("D:\Book2.xlsx")
        Application.Goto Reference:="Table1"
        Selection.ClearContents    Windows("Book1.xlsm").Activate
        Range("Table1").Select
        Selection.Copy
        Windows("Book2.xlsx").Activate
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Application.CutCopyMode = False
        ActiveWorkbook.Save
        ActiveWindow.Close
    End Sub
    Instead of the "Clearcontent" in the code above in red.
    I need help on a code that will remove all the duplicate lines in the end.

    So it copy/paste and the check for duplicate lines and remove them save

    Private Sub CommandButton2_Click()
        Workbooks.Open ("D:\Book2.xlsx")
        Windows("Book1.xlsm").Activate
        Range("Table1").Select
        Selection.Copy
        Windows("Book2.xlsx").Activate
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Application.CutCopyMode = False
        Somewhere Over here should be that line i think
        ActiveWorkbook.Save
        ActiveWindow.Close
    End Sub
    Thanks in advance
    Last edited by Rage; 11-10-2009 at 10:04 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1