Thread: Insert formula
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Insert formula

Sub InsertRow_At_Change()
'Sandy Mann July 1st, 2007
Dim LastRow As Long
Dim X As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False

For X = LastRow To 2 Step -1
If Cells(X, 1).Value < Cells(X - 1, 1).Value Then
If Cells(X, 1).Value < "" Then
If Cells(X - 1, 1).Value < "" Then
Cells(X, 1).EntireRow.Insert
End If
End If
End If
Next X
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 25 May 2010 08:09:01 -0700, John
wrote:

Hi all,

Is there a way to insert a row automatically in between a different number
when the number change?. Like creating a macro or something. I do not want to
do it manually. I have about 200 rows to insert. Please see example below. I
want to be able to insert a row in between 2000045 and 200061 also between
2000061 and 2000069 and so on.....

2000045
2000045
2000045
2000061
2000061
2000061
2000069
2000069
2000076
2000076
2000076
2000087
2000087