Program to insert rows

C

CarlosAntenna

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top