+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Registered User
    Join Date
    06-09-2009
    Location
    Veldhoven, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    32

    re: Delete duplicates

    Okay, I've attached an example.

    Sheet1 contains the master information.
    Sheet2 contains the column to find: A1 is the column name, B1 is the column address.
    Sheet3 contains the copied information of Sheet1 and needs to be uniquified. All columns other than Column7 can have data, but is left out for readability.
    Attached Files Attached Files

  2. #17
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    re: Delete duplicates

    Code:
    Sub RemoveDups()
        Dim iRow    As Long
        Dim vCol    As Variant
        Dim iRowEnd As Long
    
        vCol = Worksheets("Sheet2").Range("B1").Value
    
        With Worksheets("Sheet3").Columns(vCol)
            iRowEnd = .Cells(.Rows.Count).End(xlUp).Row
            For iRow = iRowEnd To 2 Step -1
                If WorksheetFunction.CountIf(Range(.Cells(1), .Cells(iRow - 1)), .Cells(iRow).Value) > 0 Then
                    .Cells(iRow).EntireRow.Delete
                End If
            Next iRow
        End With
    End Sub
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #18
    Registered User
    Join Date
    06-09-2009
    Location
    Veldhoven, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    32

    re: Delete duplicates

    Hi, thanks for all your help! It worked!!!

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.2.0