View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Need to find two consecutive identical cells (in a column).

John,

If you need to delete non-dupe rows (with my solution rather than a macro), simply filter for FALSE,
then select all the FALSES, and use edit / go to.. Special cells Visible cells only, and delete
the rows. Then turn off the filter.

HTH,
Bernie
MS Excel MVP


"How did I get here?" wrote in message
...
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