add a row after every unique number
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 |
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 On Fri, 30 Sep 2005 04:47:03 -0700, "tri_p" wrote: 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 |
gord..you da man! That worked AWESOME!!
"Gord Dibben" wrote: 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 On Fri, 30 Sep 2005 04:47:03 -0700, "tri_p" wrote: 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 |
Aw shucks<g
Thanks for the feedback. Gord On Fri, 30 Sep 2005 12:01:02 -0700, "tri_p" wrote: gord..you da man! That worked AWESOME!! "Gord Dibben" wrote: 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 On Fri, 30 Sep 2005 04:47:03 -0700, "tri_p" wrote: 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 |
All times are GMT +1. The time now is 11:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com