Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using cell value to reference another cell
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using cell value to reference another cell
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 wrote: 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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using cell value to reference another cell
Sheets(2).Range(Sheets(1).Range("A1").Value) = Sheets(1).Range("B1")
HTH Charles Chickering wrote: 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
absolute cell reference A spreadsheet cell reference that does no | Excel Discussion (Misc queries) | |||
Cell Formula reference to cell Based On third Cell Content | Excel Discussion (Misc queries) | |||
Cell Formula reference to cell Based On third Cell Content | Excel Discussion (Misc queries) | |||
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. | Excel Worksheet Functions | |||
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable | Excel Worksheet Functions |