Delete Duplicate rows in an Excel list

G

Gord Dibben

Data>Filter>Advanced Filter.

Unique Records and Copy to a new location.


Gord Dibben MS Excel MVP
 
C

Chris Bode

Well, it is quite uneasy to tell without seeing the worksheet, though
suggest a solution with macro
Suppose we have a sheet and we want to delete rows with repeatin
values in column A then, following macro codes can help

Place a command button on the sheet1 from control box, open the cod
window and paste following codes

Code
-------------------

Private Sub CommandButton1_Click()
Dim row As Integer, col As Integer
row = 1
col = 1

While Sheet1.Cells(row, col).Value <> ""
deleteDuplicate row, Sheet1.Cells(row, col).Value
row = row + 1
Wend
End Sub

Private Sub deleteDuplicate(i As Integer, str As String)
Dim row As Integer, col As Integer
row = i + 1
col = 1

While Sheet1.Cells(row, col).Value <> ""
If Sheet1.Cells(row, col).Value = str Then
Sheet1.Rows(row).Delete
End If
row = row + 1
Wend
End Sub

-------------------




Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top