Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help on repetetive row inserts and copying????

Hi! I know there is a way to do this but I cannot remember how to do it....

I know I did it in the past and can't for the life of me remeber how I
accomplished it.

I'm using Excel 2003. I have a long column of numbers. I want to insert 4
rows after each number and then copy that number into each new row.

Any thoughts how to accomplish this automatically?

Denise









  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help on repetetive row inserts and copying????

Try something like

Dim LastRow As Long
Dim Ndx As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For Ndx = LastRow To 1 Step -1
Rows(Ndx).Resize(4).Insert
Rows(Ndx + 4).Resize(5, 1).Value = Rows(Ndx + 4).Cells(1,
"A").Value
Next Ndx



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Denise" wrote in message
news:1132596976.351b253b8f44b61a06e46a3c9d4ea5e7@n ews.meganetnews.com...
Hi! I know there is a way to do this but I cannot remember how
to do it....

I know I did it in the past and can't for the life of me
remeber how I
accomplished it.

I'm using Excel 2003. I have a long column of numbers. I want
to insert 4
rows after each number and then copy that number into each new
row.

Any thoughts how to accomplish this automatically?

Denise











  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help on repetetive row inserts and copying????

Sub Add4rows()
Dim lastrow as Long
Dim i as Long
lastrow = cells(rows.count,1).End(xlup).row
for i = lastrow to 1 Step -1
cells(i+1).Resize(4,1).EntireRow.Insert
cells(i+1).Resize(4,1).Value = cells(i,1).Value
Next
End Sub

Code is untested an may contain typos which you can readily correct.

--
Regards,
Tom Ogilvy


"Denise" wrote in message
news:1132596976.351b253b8f44b61a06e46a3c9d4ea5e7@n ews.meganetnews.com...
Hi! I know there is a way to do this but I cannot remember how to do

it....

I know I did it in the past and can't for the life of me remeber how I
accomplished it.

I'm using Excel 2003. I have a long column of numbers. I want to insert

4
rows after each number and then copy that number into each new row.

Any thoughts how to accomplish this automatically?

Denise











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
Snapshot Inserts Sarah Excel Discussion (Misc queries) 1 June 20th 09 04:00 PM
marco that inserts rows? lloydyleg11 Excel Worksheet Functions 3 August 7th 06 12:37 AM
marco that inserts rows? lloydyleg11 Excel Worksheet Functions 0 August 3rd 06 04:54 AM
Excel Inserts martins Excel Discussion (Misc queries) 1 July 19th 06 08:03 PM
Any thoughts on repetetive row inserts and copying???? Denise Excel Discussion (Misc queries) 1 November 21st 05 08:21 PM


All times are GMT +1. The time now is 01:25 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"