Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
IK IK is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy&paste a variable range rows and colums IK Excel Discussion (Misc queries) 1 August 30th 06 12:06 AM
Setting a range within a loop variable for copy/paste Craig[_24_] Excel Programming 3 December 21st 05 04:05 PM
Copy/paste range variable between workbooks Jim73 Excel Programming 2 January 14th 05 08:17 AM
how do i use the function to copy and paste a determined variable. Strem Excel Worksheet Functions 2 January 8th 05 05:31 PM
Paste a Range from a variable Al[_11_] Excel Programming 3 October 28th 03 06:04 PM


All times are GMT +1. The time now is 10:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"