Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default copy a range with known start column to variable end column

Dear All,

Within a loop, I want to copy a range of values then paste to another range.
I don't know the syntax to write a variable into the range address.

activesheet.range("myVariableCol myVarRow", "myVarCol myVarRow").copy_
otherSheet.range("myVarCol myVarRow")
is what I am trying to achieve.
- The two positions are in the same absolute address in both sheets.

Any help appreciated,

Matilda
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default copy a range with known start column to variable end column

Use it like this
For testing it select the range

myVarRow1 = 2
myVariableCol1 = 1
myVarRow2 = 10
myVariableCol2 = 3

Range(Cells(myVarRow1, myVariableCol1), Cells(myVarRow2, myVariableCol2)).Select


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Matilda" wrote in message ...
Dear All,

Within a loop, I want to copy a range of values then paste to another range.
I don't know the syntax to write a variable into the range address.

activesheet.range("myVariableCol myVarRow", "myVarCol myVarRow").copy_
otherSheet.range("myVarCol myVarRow")
is what I am trying to achieve.
- The two positions are in the same absolute address in both sheets.

Any help appreciated,

Matilda



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default copy a range with known start column to variable end column

I get it! Many thanks Ron

"Ron de Bruin" wrote:

Use it like this
For testing it select the range

myVarRow1 = 2
myVariableCol1 = 1
myVarRow2 = 10
myVariableCol2 = 3

Range(Cells(myVarRow1, myVariableCol1), Cells(myVarRow2, myVariableCol2)).Select


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Matilda" wrote in message ...
Dear All,

Within a loop, I want to copy a range of values then paste to another range.
I don't know the syntax to write a variable into the range address.

activesheet.range("myVariableCol myVarRow", "myVarCol myVarRow").copy_
otherSheet.range("myVarCol myVarRow")
is what I am trying to achieve.
- The two positions are in the same absolute address in both sheets.

Any help appreciated,

Matilda




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
Sum values in a column depending on start time in another column Morgan New Users to Excel 5 October 26th 09 01:02 AM
Excel sum with variable start column Excel semi-smart Excel Worksheet Functions 3 March 14th 09 07:22 PM
Concatenate column with variable to set a range april Excel Discussion (Misc queries) 2 November 26th 07 03:26 PM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_15_] Excel Programming 0 October 5th 04 06:46 AM
Determine start column/ end column of Merged Cell jC! Excel Programming 3 July 8th 04 12:05 PM


All times are GMT +1. The time now is 12:37 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"