ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy/inserting rows at specific intervals (https://www.excelbanter.com/excel-programming/279785-copy-inserting-rows-specific-intervals.html)

mark

copy/inserting rows at specific intervals
 
I need to let a user input a number corresponding to the
number of samples (e.g., 1-5).

TO do this I plan on copying a series of rows (acting as a
template) for example 4-9 and then paste this in starting
at row 10 for each sample. So I would have identical rows
starting at 4, 10, 15, etc (based on the user input)

I can capture the user input and copy the 'template' rows
with no problem. My question is how do I 'insert copies'
at specific rows multiple times?

Thanks for your help - Mark.

Dick Kusleika[_3_]

copy/inserting rows at specific intervals
 
Mark

Something like this, I think

Sub MakeTemplate()

Dim NoOfCopies As Long
Dim i As Long

NoOfCopies = Application.InputBox("Enter number of samples")

For i = 10 To (NoOfCopies * 5 + 5) Step 5
Range("A4:A8").EntireRow.Copy
Range("a" & i).Resize(5).EntireRow.PasteSpecial
Next i

Application.CutCopyMode = False

End Sub
--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"mark" wrote in message
...
I need to let a user input a number corresponding to the
number of samples (e.g., 1-5).

TO do this I plan on copying a series of rows (acting as a
template) for example 4-9 and then paste this in starting
at row 10 for each sample. So I would have identical rows
starting at 4, 10, 15, etc (based on the user input)

I can capture the user input and copy the 'template' rows
with no problem. My question is how do I 'insert copies'
at specific rows multiple times?

Thanks for your help - Mark.





All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com