ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking entire row for duplicates (https://www.excelbanter.com/excel-programming/304087-re-checking-entire-row-duplicates.html)

Tom Ogilvy

Checking entire row for duplicates
 
Sub Dups()
Dim bDup as Boolean
Do
bDup = True
for each cell in Activecell.EntireRow.Cells
If cell.Value < Cell.Offset(1, 0).Value Then
bDup = False
exit for
End If
next
if bDup then
ActiveCell.Offset(1,0).EntireRow.Delete
else
ActiveCell.Offset(1,0).Select
End if
Loop Until isempty(ActiveCell.Value)
End Sub

--
Regards,
Tom Ogilvy



"SHiggins" wrote in message
...
I am trying to remove duplicates in my data where the entire row matches

the one under it. So far I have it where it checks just one cell to see if
it matches. How do I have it look at the entire row?

Thanks!

Here is my code so far:

Sub Dups()
Do
If ActiveCell.Value = ActiveCell.Offset(1, 0).Value Then
'ActiveCell.EntireRow.Delete
ActiveCell.Offset(1, 0).EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Value = Empty
End Sub





All times are GMT +1. The time now is 10:31 AM.

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