Issue:

You have a long MS Excel list that contains duplicates. You want to delete all duplicate rows.

Resolution

Sub Delete_Dupes()
'Declare your variables
Dim I As String, J As Integer
'Get your list ID Column
I = InputBox("Enter the ID Column for your list", "ID Column", "A")
'Get your list Start Row
J = InputBox("Enter the start row for your list", "List Row", 1)
'Select the first cell of your column
Range(I & J).Select
'Sort your data list by the ID column
Selection.Sort Key1:=Range(I & J), Order1:=xlAscending, Header:=xlGuess
'Tell VBA where to start it's search
Set c = Range(I & J)
Do While Not IsEmpty(c)

'If you find a duplicate...
If c = c.Offset(1, 0) Then
Do While c = c.Offset(1, 0)
'Delete the entire row
c.Offset(1, 0).EntireRow.Delete
'Cycle through the duplicate entries
Loop
End If
Set c = c.Offset(1, 0)
'Cycle through your data list
Loop
End Sub

� 2002 Dan Herrera
These functions may be distributed freely, but please give credit where credit is due.
And if you feel you must give credit, or have a request for a custom function/macro,
please send me a note DataMasterFla

Sign Guestbook View Guestbook

Back.

Hosted by www.Geocities.ws

1