ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   place a blank row above certain cells (https://www.excelbanter.com/excel-worksheet-functions/177581-place-blank-row-above-certain-cells.html)

aledger

place a blank row above certain cells
 
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.

Don Guillett

place a blank row above certain cells
 

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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"aledger" wrote in message
...
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.



Gord Dibben

place a blank row above certain cells
 
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

On Fri, 22 Feb 2008 07:51:02 -0800, aledger
wrote:

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.




All times are GMT +1. The time now is 01:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com