View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Anne Troy
 
Posts: n/a
Default I need help with deleting duplicate, and the original cell, row.

Open your workbook. Hit Alt+F11 to open the VB Editor. From the menu, choose
Insert--Module. Paste the following code into the code window that appears
at right.
---code starts below---
Option Explicit

Sub deleteDups()
Dim rngCell As Range
Dim lngRow As Long

For Each rngCell In ActiveSheet.UsedRange.Columns(1).Cells
If Application.WorksheetFunction.CountIf(rngCell.Enti reColumn,
rngCell) 1 Then
rngCell.Cells(1, 2).Value = "TAGGED"
End If
Next

For lngRow = ActiveSheet.UsedRange.Columns(1).Rows.Count To 1 Step -1
Set rngCell = ActiveSheet.UsedRange.Columns(1).Cells(lngRow, 1)
If rngCell.Cells(1, 2).Value = "TAGGED" Then
rngCell.EntireRow.Delete
End If
Next
End Sub
---code ends above---

Hit the SAVE diskette if you want to save the macro for next time.
Close the VB Editor window.
Tools--Macro--Macros and double-click deleteDups. You can assign it to a
toolbar button or shortcut key, too. Here's how:
http://www.officearticles.com/misc/m...ica tions.htm

************
Hope it helps!
Anne Troy
www.OfficeArticles.com

"Jimv" wrote in message
...
I have a list of email addresses, I need to purge out the "unsubscribes".
I
can find all types of macros that will delete the duplicate entry, but
nothing that will also purge the original, or unique counterpart of the
duplicate.
Can anyone help with this.

thanks

Jim