place a blank row above certain cells

A

aledger

I would like to add a row above certain cells that repeat themself. For
example, Column T list several company names like this.
Arby's
Arby's
Arby's
Burger King
Burger King
Burger King

My list is very long and I would like to create a formula that would
automatically place a blank row between company names. Any help is greatly
appreciated. Thanks.
 
D

Don Guillett

something like

sub insertrowsif()
mc="a"
for i=cells(rows.count,mc).end(xlup).row to 2 step -1
if cells(i-1,mc)<>cells(i,mc) then rows(i).insert
next i
end sub
 
G

Gord Dibben

Easy to do but will screw up any chance of sorting or filtering you may want to
do with the names.

Maybe better would be to make the first instance of each new name double-height?

Sub insertrowsif()
mc = "a"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) <> Cells(i, mc) Then
With Rows(i)
.RowHeight = .RowHeight * 2
End With
End If
Next i
End Sub


Gord Dibben MS Excel MVP
 
Top