Using cell value to reference another cell

S

slowjam4

Hi,
I have a worksheet1 with the following contents:

Cell A1 = "C3"
Cell B1 = "123.45"
Cell A2 = "D5"
Cell B2 = "333.12"
Cell A3 = "B12"
Cell B3 = "34.99"
..
..
..


I would like to write a macro to move worksheet1 Cell B1("123.45") to
worksheet2 Cell C3 and move worksheet1 Cell B2("333.12") to worksheet2
Cell D5 ... and continue doing this until the last row with data is
encountered on worksheet1.


In other words use the contents of worksheet1, column A to determine
which Cell to reference on worksheet2.


Can someone help me with this?
 
J

John Fuller

This should work.

Sub Xfer()
Dim LastRow As Integer

LastRow = 3

For i = 1 To LastRow
Worksheets("Sheet2").Range(Worksheets("Sheet1"). _
Cells(i, 1).Value).Value = _
Worksheets("Sheet1").Cells(i, 2).Value
Next i
End Sub
 
D

Die_Another_Day

Sheets(2).Range(Sheets(1).Range("A1").Value) = Sheets(1).Range("B1")

HTH

Charles Chickering
 

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

Top