Use a cell value to point to desired location.
Hi Gene,
For scenario1, try:
'=============
Public Sub TesterA()
Dim Rng1 As range, rng2 As range
Dim arr As Variant
Set Rng1 = range("A1")
Set rng2 = range("D1")
arr = Split(Rng1.Value, ",")
Cells(CLng(arr(1)), CLng(arr(0))).Value = rng2.Value
End Sub
'<<=============
For the second scenario, try:
'=============
Public Sub TesterB()
Dim Rng1 As range, rng2 As range, rng3 As range
Dim i As Long, j As Long
Set Rng1 = range("A1")
Set rng2 = range("B2")
Set rng3 = range("D1")
i = Rng1.Value
j = rng2.Value
Cells(j, i).Value = rng3.Value
End Sub
'<<=============
---
Regards,
Norman
"GeneWan" wrote in message
...
scenario 1: say, if cell A1 contains the value 10,2 and cell D1 contains
value 8.
scenario 2: say, if cell A1=10, cell B2=2 and D1=8.
how can I write a macro to select the cell J2 (ie. 10,2) and place the
value
8 in it? ie. use the values as an X,Y coordinate. Which would be the more
efficient way of doing it?
|