View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bruno Campanini[_3_] Bruno Campanini[_3_] is offline
external usenet poster
 
Posts: 52
Default Need to find two consecutive identical cells (in a column).

"How did I get here?" <How did I get wrote
in message ...
My machine names are in the first column in a spreadsheet. I need to find
or
flag in some way, those instances in which a machine name in one row
is followed by the same name appearing again in the next row's first
column.


It would be fine (but not necessary) to reveal this by deleting all other
rows
that do not repeat in this way.

Thanks,
john c


SourceRange is the Top Cell of your contiguous range
----------------------------------------
Public Sub FlagNonDups()
Dim i As Long, SourceRange As Range

Set SourceRange = [Sheet12!H90]
If Not IsEmpty(SourceRange.Offset(1, 0)) Then
Set SourceRange = SourceRange.Resize(SourceRange. _
End(xlDown).Row - SourceRange.Row + 1)
End If

For i = 1 To SourceRange.Rows.Count - 1
If SourceRange(i) < SourceRange(i + 1) Then
SourceRange(i) = "*"
Else
i = i + 1
End If
Next

End Sub
-----------------------------------------
Ciao
Bruno