ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete Duplicate rows in an Excel list (https://www.excelbanter.com/excel-discussion-misc-queries/223377-delete-duplicate-rows-excel-list.html)

Jmh3115

Delete Duplicate rows in an Excel list
 


Gord Dibben

Delete Duplicate rows in an Excel list
 
DataFilterAdvanced Filter.

Unique Records and Copy to a new location.


Gord Dibben MS Excel MVP







Chris Bode[_12_]

Delete Duplicate rows in an Excel list
 

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

Place a command button on the sheet1 from control box, open the code
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
------
Convert your Excel spreadsheet into an online calculator.
http://www.spreadsheetconverter.com




--
Chris Bode


All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com