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.
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.
Maybe..
Select Range---> Go to Data--->Remove duplicates
Life's a spreadsheet, Excel!
Say thanks, Click *
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]
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
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks