adding row after comparison


Posted by Henri on June 19, 2000 9:31 PM

Hi!

I have text values in same column
and I woluld like to do next procedure.

if cell A1 and A2 has the same value do nothing, but if the cells have different value separate them with full row

?? if active.cell <> .value rows.insert then goto next comparison if cells are empty endif.

Posted by mads on June 19, 0100 11:37 PM


:


Dim cell As Range
Set cell = Range("A3")
Do Until cell = ""
If cell.Offset(-2, 0) <> cell.Offset(-1, 0) Then cell.EntireRow.Insert
Set cell = cell.Offset(2, 0)
Loop

mads



Posted by mads on June 19, 0100 11:51 PM


The code previously sent might not do what you want. If not, maybe this does it :-

Dim cell As Range
Set cell = Range("A2")
Do Until cell = ""
If cell.Offset(-1, 0) <> cell Then cell.EntireRow.Insert
Set cell = cell.Offset(2, 0)
Loop

mads