Copy Range Multiple Times

healey21

Well-known Member
Joined
Dec 22, 2009
Messages
900
Can anyone help with VBA code to copy a range of cells A2:L4 10 times with a gap of 2 rows between each table.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Can anyone help with VBA code to copy a range of cells A2:L4 10 times with a gap of 2 rows between each table.
Try this in a copy of your workbook.


<font face=Courier New><br><SPAN style="color:#00007F">Sub</SPAN> CopyRange()<br>    <SPAN style="color:#00007F">Dim</SPAN> rws <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <br>    <SPAN style="color:#00007F">With</SPAN> Range("A2:L4")<br>        rws = .Rows.Count + 2<br>        .Resize(rws).Copy Destination:=.Offset(rws).Resize(rws * 10)<br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Upvote 0
Try this in a copy of your workbook.



Sub CopyRange()
Dim rws As Long

With Range("A2:L4")
rws = .Rows.Count + 2
.Resize(rws).Copy Destination:=.Offset(rws).Resize(rws * 10)
End With
End Sub

Peter thank you this will enable me to move to the final stage of this project.
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,240
Members
452,898
Latest member
Capolavoro009

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