Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic insertion of row renegade Excel Worksheet Functions 3 January 27th 10 10:58 AM
Row Insertion mlockman Excel Discussion (Misc queries) 0 April 17th 09 03:33 PM
Automatic row insertion PURVIANCE Excel Discussion (Misc queries) 1 December 6th 06 08:59 PM
Prevent row insertion Kathy Excel Discussion (Misc queries) 2 March 22nd 06 09:09 PM
Global macro insertion CLR Excel Programming 2 October 11th 03 03:40 PM


All times are GMT +1. The time now is 08:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"