View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default 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.