PDA

View Full Version : [SOLVED:] Range with a variable



lucas
07-10-2005, 09:09 AM
The help files don't address much about variables in ranges. I have been trying to figure out how to change this selection and copy statement which catches the next row in line and column B & C to just catch the next row in line and only column B.



Range(Cells(x - 1, 2), Cells(x - 1, 3)).Copy Cells(x, 2)
This is obviously not working for me

Range(Cells(x - 1, 2)).Copy Cells(x, 2)

Bob Phillips
07-10-2005, 09:34 AM
The help files don't address much about variables in ranges. I have been trying to figure out how to change this selection and copy statement which catches the next row in line and column B & C to just catch the next row in line and only column B.



Range(Cells(x - 1, 2), Cells(x - 1, 3)).Copy Cells(x, 2)

'This is obviously not working for me

Range(Cells(x - 1, 2)).Copy Cells(x, 2)



Cells(x - 1, 2).Copy Cells(x, 2)

or


Range("B" & x - 1).Copy Range("B" & x)

lucas
07-10-2005, 09:52 AM
Thanks XLD,
That works great.