ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I insert a blank line when category changes (https://www.excelbanter.com/excel-discussion-misc-queries/111781-how-do-i-insert-blank-line-when-category-changes.html)

castleds

How do I insert a blank line when category changes
 
In Excel 2003, I have a spreadsheet with over 1500 rows that I would like to
insert a blank row everytime the category changes in one row.

Don Guillett

How do I insert a blank line when category changes
 
for i =cells(rows.count,"a").end(xlup).row to 2 step -1
if cells(i,"a")=categorychange then rows(i).insert
next

--
Don Guillett
SalesAid Software

"castleds" wrote in message
...
In Excel 2003, I have a spreadsheet with over 1500 rows that I would like
to
insert a blank row everytime the category changes in one row.




Gord Dibben

How do I insert a blank line when category changes
 
Sub InsertRow_At_Change()
Dim i As Long
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) < Cells(i, 1) Then _
Cells(i, 1).Resize(1, 1).EntireRow.Insert
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP

On Wed, 27 Sep 2006 06:35:01 -0700, castleds
wrote:

In Excel 2003, I have a spreadsheet with over 1500 rows that I would like to
insert a blank row everytime the category changes in one row.




All times are GMT +1. The time now is 07:04 AM.

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