Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Row insertion macro
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Row insertion macro
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 -- Regards, Tom Ogilvy "Jeff" wrote in message ... 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Row insertion macro
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 --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Jeff" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
automatic insertion of row | Excel Worksheet Functions | |||
Row Insertion | Excel Discussion (Misc queries) | |||
Automatic row insertion | Excel Discussion (Misc queries) | |||
Prevent row insertion | Excel Discussion (Misc queries) | |||
Global macro insertion | Excel Programming |