Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Copy and Paste a variable range
I have a formula returning a numerical # (like 25). I want to copy and paste
a range from Column A4 to Column GXX) Using that # number as the quantity of rows that I have go to down. Also the data is going to be selected from another sheet, using that variable range specified in the sheet that the data is going to be pasted. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Copy and Paste a variable range
Let's say your formula is in cell A1, then:
Sub gsnu() Dim howbig As Long Dim r1 As Range Dim r2 As Range howbig = Range("A1").Value Set r1 = Worksheets("Sheet2").Range(Cells(4, 1), Cells(howbig, "G")) Set r2 = Worksheets("Sheet3").Range("A4") r1.Copy r2 End Sub will copy the defined block from Sheet2 to the same place in Sheet3 -- Gary''s Student "IK" wrote: I have a formula returning a numerical # (like 25). I want to copy and paste a range from Column A4 to Column GXX) Using that # number as the quantity of rows that I have go to down. Also the data is going to be selected from another sheet, using that variable range specified in the sheet that the data is going to be pasted. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to copy&paste a variable range rows and colums | Excel Discussion (Misc queries) | |||
Setting a range within a loop variable for copy/paste | Excel Programming | |||
Copy/paste range variable between workbooks | Excel Programming | |||
how do i use the function to copy and paste a determined variable. | Excel Worksheet Functions | |||
Paste a Range from a variable | Excel Programming |