add a row after every unique number

T

tri_p

Is there a function that will add an entire row after a unspecified group of
number.

ie I have some numbers, these numbers could be negitave numbers and range in
string size. There will be groupings and after each grouping upon a new
number I would like to add an entire row (for later calculations).

Is this possible (for someone with minimal programming exp)?

Thanks
 
G

Gord Dibben

tri_p

Assuming the numbers are in Column A, run this 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

For column C.........

For i = Cells(Rows.Count, 3).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 3) <> Cells(i, 3) Then _


Gord Dibben Excel MVP
 
T

tri_p

gord..you da man! That worked AWESOME!!

Gord Dibben said:
tri_p

Assuming the numbers are in Column A, run this 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

For column C.........

For i = Cells(Rows.Count, 3).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 3) <> Cells(i, 3) Then _


Gord Dibben Excel MVP
 
Top