View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Need to find two consecutive identical cells (in a column).

Just to add a refinement.
You can skip the Edit/goto special cells, visible cells only part - it is
redundant. When you delete rows in a filter, only the visible rows are
deleted.

As to your comment about simplicity, I am not sure how Edit=Macro=Macros
then Select the macro name in the dialog and hit run is all that complex
<g.

--
Regards,
Tom Ogilvy

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
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