View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett
 
Posts: n/a
Default Insert Blank Line

Please stay in the SAME thread when replying.

--
Don Guillett
SalesAid Software

"aashish" wrote in message
...
Gord - this works, but how can I change the code to only insert rows if
Column C does not equal the row above it?

thanks,
Aashish

"Gord Dibben" wrote:

Sherry

Are you OK with a macro?

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

Assumes column A is the one with the data.

If not familiar with VBA and macros, see David McRitchie's site for more
on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic
Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the above code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to ToolMacroMacros.


Gord Dibben Excel MVP

On Mon, 12 Sep 2005 13:24:01 -0700, Sherry

wrote:

I have a column that has certain number information and I'm wanting to
insert
a blank line each time the number changes.

Example:

004012
004012
004012
004013
004013
004014
004014

I want to put a blank line betwenn 004012 and 004013 and then again
between
004013 and 004014.

Is there an easy way to do this? I have 700 records and the numbers are
different.

Thanks in advance for any help.