+ Reply to Thread
Results 1 to 5 of 5

Removing Duplicate Rows

Hybrid View

jray9242 Removing Duplicate Rows 08-02-2012, 03:56 PM
Ace_XL Re: Removing Duplicate Rows 08-02-2012, 04:09 PM
arlu1201 Re: Removing Duplicate Rows 08-02-2012, 04:11 PM
day92 Re: Removing Duplicate Rows 08-02-2012, 04:59 PM
mike7952 Re: Removing Duplicate Rows 08-02-2012, 05:11 PM
  1. #1
    Registered User
    Join Date
    05-07-2011
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    28

    Removing Duplicate Rows

    How can I remove duplicate rows? I know there is a conditional way to mark it, but I want to do the following.

    First Last Raw
    Jim Ray
    Jim Ray
    John Doe
    John Doe


    First Last Results
    Jim Ray
    John Doe


    Thank you.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Removing Duplicate Rows

    Maybe..

    Select Range---> Go to Data--->Remove duplicates
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Removing Duplicate Rows

    Have you tried the remove duplicates option in excel 2007? Go to Data -> Remove Duplicates.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: Removing Duplicate Rows

    Arlette mentioned the easiest way but if you want code to do it, you can use this..

    Sub RemoveDupilctes()
         
        Dim x As Long
        Dim LastRow As Long
         
        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
            End If
        Next x
         
    End Sub

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Removing Duplicate Rows

    Heres just another code example to delete all rows at once. Faster then deleting one row at a time

     Sub del_unwantedRows()
    Dim RangeToDelete As Range
    Dim Lastrow As Long
        Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
        For X = 1 To Lastrow
            If Application.WorksheetFunction.CountIf(Range("A1:A" & X), Cells(X, "A").Text) > 1 Then
                If RangeToDelete Is Nothing Then
                    Set RangeToDelete = Cells(X, "A")
                Else
                    Set RangeToDelete = Union(RangeToDelete, Cells(X, "A"))
                End If
            End If
        Next X
        If Not RangeToDelete Is Nothing Then
            RangeToDelete.EntireRow.Delete
        End If
    End Sub

+ Reply to Thread

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