Hello marionmccaleb, welcome to the board.
I think you'll find this to be a bit more efficient than the example shown in the MS support
(Assumes your list is in column A of Sheet1. Change those to suit.)
Dim LstRw As Long, Rng As Range, c As Range, DltRng As Range
LstRw = .Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = .Range("A1:A" & LstRw)
For Each c In Rng
If WorksheetFunction.CountIf(Rng, c.Value) > 1 Then
If DltRng Is Nothing Then
Set DltRng = c
Set DltRng = Union(DltRng, c)
If Not DltRng Is Nothing Then DltRng.EntireRow.Delete
Thanks for your suggestion Anne---HalfAce, thanks a bunch for taking the time to develop the code which I will cut and paste into a macro---I will let you know how it works when I find time to check it out---best wishes, Marion McCaleb
To install the code:
1) Save a copy of your real workbook. (Don't ever want to be testing in the real thing) :wink:
2) With your copied workbook open - Press Alt+F11. (This will open up the vb editor.)
3) While in the vb editor, press Ctrl+R. (This will open up the ProjectExplorer if it isn't already.)
4) In the ProjectExplorer pane (usually on the left side of your screen) locate the name of your
copied workbook. Locate & right click on 'ThisWorkbook' below that.
Choose Insert > Module. (This will insert a 'standard' code module named Module1 or
5) Copy the code from here and paste it into the white area on the right that is your new
6) Press Alt+Q to close the vb editor and get back to your worksheet.
To run the code:
1) From the menu, choose Tools > Macro > Macros... (Or you can just press Alt+F8)
2) In the 'Macro' window that opens up, select the macro named 'DeleteDupesDemo' and
click the Run button. (Or you can just double click the macro named 'DeleteDupesDemo'.)
3) Check out sheet1, column A to see that no instances of your duplicated data still exists.
If all is as you want it to be you can install a button on your sheet somewhere, assign
the code to it and use that to run it if you wish.
Yes, chearn suggests another perfectly acceptable (and to a lot of folks preferable) way.
The only real advantage to using the code would be if you have users that aren't all that
savvy with excel or wanted to maybe have it execute automatically whenever a duplicate entry