Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 210
Default make excel copy a row and automatically insert new rows

How do I make excel copy a row and then automatically insert new rows that
are copies of that row based on a number input by a user (i.e. a user unoyuts
'10' in a cell excel copies the content of row 51 abd then inserts 10 new
rows that are copies of row 51)?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default make excel copy a row and automatically insert new rows

Sub copyrows()
numrows = InputBox("Number of rows")
'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows)
Rows(ActiveCell.Row).Copy
ActiveCell.Resize(numrows).Insert
Application.CutCopyMode = False
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Robin" wrote in message
...
How do I make excel copy a row and then automatically insert new rows that
are copies of that row based on a number input by a user (i.e. a user
unoyuts
'10' in a cell excel copies the content of row 51 abd then inserts 10 new
rows that are copies of row 51)?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 210
Default make excel copy a row and automatically insert new rows

Don,
Thank you for your help.
Was able to get your code to work (copy and insert rows in Excel). It
worked good. I do have a follow-on question. Is there a way to get one of
the copied cells to increment based on a starting number in the row to be
copied? In other words, in the row to be copied there is a cell with a value
of '1' and we need that value to be incremented for each new row that is
inserted. So, if we have Excel insert ten additional rows, that number
should be incremented from '1' in the copied row all the way to '11' in the
newly inserted rows.
Sincerely,

Robin

Does that make sense?


"Don Guillett" wrote:

Sub copyrows()
numrows = InputBox("Number of rows")
'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows)
Rows(ActiveCell.Row).Copy
ActiveCell.Resize(numrows).Insert
Application.CutCopyMode = False
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Robin" wrote in message
...
How do I make excel copy a row and then automatically insert new rows that
are copies of that row based on a number input by a user (i.e. a user
unoyuts
'10' in a cell excel copies the content of row 51 abd then inserts 10 new
rows that are copies of row 51)?



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
Automatically Insert New Rows Eric Excel Discussion (Misc queries) 0 June 12th 07 10:54 PM
How can I set excel to automatically insert rows Tima Excel Worksheet Functions 9 August 13th 06 05:19 PM
how do you have rows automatically insert in excel? Shelvonne Excel Worksheet Functions 0 November 10th 05 12:37 AM
Automatically insert page break every 6 rows in excel doc Icetea Excel Discussion (Misc queries) 1 October 10th 05 11:55 AM
Automatically insert row and copy formula Wendy Excel Worksheet Functions 5 August 25th 05 06:35 PM


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