Row insertion macro

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Let's say I have a spreadsheet in which a unique number
is entered into column A, rows 1 through 5.

Column A
Row 1 100
Row 2 200
Row 3 300
Row 4 400
Row 5 500

I need a macro that will insert 9 rows after each entry,
copying original value. To further clarify, the macro
needs to read the value of cell 1A (100), and then insert
9 rows underneath containing the same value (100). I need
this done for all 5 original rows. Thanks.
 
Sub AATester1()
Dim i As Long
For i = 5 To 1 Step -1
Rows(i + 1).Resize(9).Insert
Cells(i, 1).Resize(10).Value = Cells(i, 1)
Next

End Sub
 
Hi anonymous poster Jeff,
Only 5 rows or all of your rows. In any case you insert or delete
rows from the bottom up. If you want only 5 rows then you can
hard code the 5 in the macro. Since you want to insert 9 rows
you don't need the inputbox.

look for InsertBlankRows() Ken Wright, 2003-08-09
http://www.mvps.org/dmcritchie/excel/insrtrow.htm

Not using a full name to identify yourself is not very friendly, in my opinion.
It also makes it hard to identify your own postings in the archives by
your email address or even by your name.
Email and privacy (for those who don't use email address)
http://support.microsoft.com/newsgroups/default.aspx
Searching newsgroups:
http://www.mvps.org/dmcritchie/excel/xlnews.htm
 
Back
Top