ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying a range (https://www.excelbanter.com/excel-programming/444045-copying-range.html)

PCOR

Copying a range
 
I want to select a given range and copy that range to 4 places:
Lets say I select a1 to e8
I want the macro to copy the selected information 4 times as
follows:
to a9:e16
a17:e24
a25: e32
F1:J8
In other words. Copy the selected data three times just below the
selected data and once to the right of the selected data.
Most appreciated and Merry Xmas to all
Ian M

Per Jessen[_2_]

Copying a range
 
This macro assume that the column right to the selection is empty, the
same goes for the rows below the selection:

Sub CopyRng()
Dim TargetRng As Range
Set TargetRng = Selection
TargetRng.Copy TargetRng.End(xlToRight).Offset(0, 1)
For r = 1 To 3
TargetRng.Copy TargetRng(1, 1).End(xlDown).Offset(1)
Next
End Sub

Regards,
Per

On 22 Dec., 16:14, pcor wrote:
I want to select a given range and copy that range to 4 places:
Lets say I select a1 to e8
I want the macro to copy the selected information * 4 times as
follows:
to a9:e16
a17:e24
a25: e32
F1:J8
In other words. Copy the selected data three times just below the
selected data and once to the right of the selected data.
Most appreciated and Merry Xmas to all
Ian M




All times are GMT +1. The time now is 11:59 AM.

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