Range Objects in Vba


Posted by Dexter Hall on July 25, 2001 10:25 AM

I'm a beginner with Vba and am trying to find a way to copy a cell's value from an active cell to another cell which is offset from a fixed address. Example: Cell A1 contains the number 50. I want to copy the value to a cell two rows below cell K1. The hitch is, the number of rows below K1 (two in this example) is defined by a value in another cell.

Any help would be greatly appreciated.



Posted by Tom Morales on July 25, 2001 11:19 AM

Dexter -
Let's say that the offset value is in cell B1. This code would do what you desire:

Sub placement()
n = Range("B1").Value
x = Range("A1").Value
Range("K1").Offset(n, 0).Value = x
End Sub

Tom