View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ken Loomis Ken Loomis is offline
external usenet poster
 
Posts: 143
Default OOPS Can Anyone Solve This One, Please, From Liz

I gave you code to delete the duplicates before I realized you just wanted
to flag them.

Sorry.

Ken Loomis


"Ken Loomis" wrote in message
...
Here is how I did that:

Sub RemoveDuplicates()

Dim totalrows As Integer
Dim nameColumn As Integer
Dim count As Integer
Dim Row As Integer

totalrows = ActiveSheet.UsedRange.Rows.count
count = 0
nameColumn = 1
For Row = totalrows To 6 Step -1

' I had some empty names that did not need to be deleted
If Cells(Row, nameColumn).Value < Empty Then

If Cells(Row, nameColumn).Value = Cells(Row - 1, nameColumn).Value
Then
Rows(Row).Delete
count = count + 1
End If
End If
Next Row
If ShowMsgs Then
MsgBox "Rows deleted equals " & count
End If

Probably not as elegant as it could have been, but hopefully it is
understanable and helps.

Ken Loomis


"Lizmerrill" wrote in message
...
How can I use excel to find consecutive duplicate entries in a column?


e.g,
Col B
1614
1522
1522 duplicate consecutive entry
how can I use excel to flag this for me?

Thanks,

Liz Merrill