ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   exel macro to eliminate duplicate record (https://www.excelbanter.com/excel-programming/304730-exel-macro-eliminate-duplicate-record.html)

FSK- in montreal

exel macro to eliminate duplicate record
 
It's been quite a few years since I've had to use macros.
But now I'm stuck. I have several large worksheets that
are the result of merged databases and I would like to use
a macro to eliminate duplicate records. This is following
a sort where I can clearly see one row and the one beneath
it has the duplicate data.

Any suggestions please!!!! Thank you

Tom Ogilvy

exel macro to eliminate duplicate record
 
Sub DeleteDups()
do while ActiveCell < ""
if activeCell.Value = activecell.Offset(1,0).Value then
ActiveCell.Offset(1,0).EntireRow.Delete
else
ActiveCell.Offset(1,0).Select
end if
Loop
End Sub

Select the first cell in the column you want to check and run the macro.

Untested, but should work. Test it on a copy of your workbook.

--
Regards,
Tom Ogilvy

"FSK- in montreal" wrote in message
...
It's been quite a few years since I've had to use macros.
But now I'm stuck. I have several large worksheets that
are the result of merged databases and I would like to use
a macro to eliminate duplicate records. This is following
a sort where I can clearly see one row and the one beneath
it has the duplicate data.

Any suggestions please!!!! Thank you




FSK - in montreal

exel macro to eliminate duplicate record
 
Thanks Tom!!
-----Original Message-----
Sub DeleteDups()
do while ActiveCell < ""
if activeCell.Value = activecell.Offset(1,0).Value

then
ActiveCell.Offset(1,0).EntireRow.Delete
else
ActiveCell.Offset(1,0).Select
end if
Loop
End Sub

Select the first cell in the column you want to check and

run the macro.

Untested, but should work. Test it on a copy of your

workbook.

--
Regards,
Tom Ogilvy

"FSK- in montreal"

wrote in message
...
It's been quite a few years since I've had to use

macros.
But now I'm stuck. I have several large worksheets that
are the result of merged databases and I would like to

use
a macro to eliminate duplicate records. This is

following
a sort where I can clearly see one row and the one

beneath
it has the duplicate data.

Any suggestions please!!!! Thank you



.


Patrick Molloy[_4_]

exel macro to eliminate duplicate record
 
There's really no need to make cells active this way - unless you like to
see the screen updating.

Sub Delete_Row()

Dim target as range
set target = activecell
Do

If Target.Value = Target.Offset(1, 0).Value Then
Target.Offset(1, 0).EntireRow.Delete
Else

Ste target = target.Offset(1, 0)
End If

Loop While target.value< ""

End Sub




--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"Soo Cheon Jheong" wrote in message
...
Try

Sub Delete_Row()

Do

If ActiveCell.Value = ActiveCell.Offset(1, 0).Value Then
ActiveCell.Offset(1, 0).EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If

Loop While ActiveCell < ""

End Sub

__







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

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