View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
How did I get here?[_2_] How did I get here?[_2_] is offline
external usenet poster
 
Posts: 3
Default Need to find two consecutive identical cells (in a column).

Thanks for your help. I worked with the next answer because it was simpler.
I will keep your script idea though in case I do need to delete non-dupe rows.
Thanks,
john c "How did I get here?"

"Tom Ogilvy" wrote:

sub RemoveNonDups()
Dim i as Long, lastrow as Long
lastrow = cells(rows.count,1).End(xlup).row
for i = lastrow to 2 step -1
if cells(i,1).value < cells(i-1).value then
rows(i).Delete
end if
Next
if cells(i,1).value < cells(i+1).value then
rows(1).Delete
End if
End Sub

--
Regards,
Tom Ogilvy


"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