Copy all rows in a sheet and paste multiple times below in the same sheet

anglais428

Well-known Member
Joined
Nov 23, 2009
Messages
634
Office Version
  1. 2016
Platform
  1. Windows
Hi Guys,

I am looking at taking the following:
A100
B500
C250

<tbody>
</tbody>

and replicating it (full rows) by 'X' times. I would like a Message Box to ask for the number of times it should be replicated.
If the user was to enter '2' then, on the same Sheet, it should look like:

A100
B500
C250
A100
B500
C250
A100
B500
C250

<tbody>
</tbody>

i.e. the original plus the 2 duplicates.
Ideally, I would like this to be a VBA solution as the number of rows is very large.
Thanks,
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try

Code:
Sub test()
Dim LR As Long, i As Long, x As String
LR = Range("A" & Rows.Count).End(xlUp).Row
x = InputBox("How many times?")
Range("A1:B" & LR).Copy
For i = 1 To x
    Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top