copy a range with known start column to variable end column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
I get it! Many thanks Ron

Ron de Bruin said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top