![]() |
Program to insert rows
I have data for bills of material that I need to manipulate.
Most of what I need to do, I can do with formulas, but the first step needs a program because it changes the structure of the worksheet. Column A contains the "parent item", column B contains the "child items". There may be 2-50 children being assembled into each parent. Consequently, there will be 2-50 rows with the same data in column A. I need to scan all of column A and each time the item number changes, insert a row in between. I really need to do this programatically because there is over 100,000 rows of data. (I had to split it between two worksheets.) Can this be done? Win2K XL2002 Carlos |
Program to insert rows
For i = Cells(Rows.Count,"A").End(xlUp).Row to 2 Step -1 If Cells(i,"A").Value < Cells(i-1,"A").Value Then Rows(i).Insert End If Next i -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "CarlosAntenna" wrote in message ... I have data for bills of material that I need to manipulate. Most of what I need to do, I can do with formulas, but the first step needs a program because it changes the structure of the worksheet. Column A contains the "parent item", column B contains the "child items". There may be 2-50 children being assembled into each parent. Consequently, there will be 2-50 rows with the same data in column A. I need to scan all of column A and each time the item number changes, insert a row in between. I really need to do this programatically because there is over 100,000 rows of data. (I had to split it between two worksheets.) Can this be done? Win2K XL2002 Carlos |
Program to insert rows
Thanks Bob !
It works perfectly. You're a lifesaver. -- Carlos "Bob Phillips" wrote in message ... For i = Cells(Rows.Count,"A").End(xlUp).Row to 2 Step -1 If Cells(i,"A").Value < Cells(i-1,"A").Value Then Rows(i).Insert End If Next i -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "CarlosAntenna" wrote in message ... I have data for bills of material that I need to manipulate. Most of what I need to do, I can do with formulas, but the first step needs a program because it changes the structure of the worksheet. Column A contains the "parent item", column B contains the "child items". There may be 2-50 children being assembled into each parent. Consequently, there will be 2-50 rows with the same data in column A. I need to scan all of column A and each time the item number changes, insert a row in between. I really need to do this programatically because there is over 100,000 rows of data. (I had to split it between two worksheets.) Can this be done? Win2K XL2002 Carlos |
All times are GMT +1. The time now is 01:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com