Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.excel
|
|||
|
|||
how to set macro using cell location
I have ten random values (text) in Column A from A1 to A10. On column
B, there are 10 numbers (between 1 to 10) arranged in random squence, so B1 may be 4, B2 may be 8 and so on. On column C, I want to get the value of the cell indicated by the NUMBER, such that if B1 is 4, then in C1 I want to display the text from A4, if B2 is 8, I want to display text from A8. Is it possible to set up a macro to utilize that? |
#2
Posted to microsoft.public.excel.programming,microsoft.public.excel
|
|||
|
|||
how to set macro using cell location
How about a worksheet formula:
Put this in C1 and drag down: =INDEX($A$1:$A$10,B1) namsilat wrote: I have ten random values (text) in Column A from A1 to A10. On column B, there are 10 numbers (between 1 to 10) arranged in random squence, so B1 may be 4, B2 may be 8 and so on. On column C, I want to get the value of the cell indicated by the NUMBER, such that if B1 is 4, then in C1 I want to display the text from A4, if B2 is 8, I want to display text from A8. Is it possible to set up a macro to utilize that? -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming,microsoft.public.excel
|
|||
|
|||
how to set macro using cell location
and if you really need a macro, here's one way:
Option Explicit Sub testme01() Dim myRng As Range Dim myCell As Range With ActiveSheet Set myRng = .Range("c1:c10") For Each myCell In myRng.Cells myCell.Value = .Range("a" & myCell.Offset(0, -1).Value) Next myCell End With End Sub Dave Peterson wrote: How about a worksheet formula: Put this in C1 and drag down: =INDEX($A$1:$A$10,B1) namsilat wrote: I have ten random values (text) in Column A from A1 to A10. On column B, there are 10 numbers (between 1 to 10) arranged in random squence, so B1 may be 4, B2 may be 8 and so on. On column C, I want to get the value of the cell indicated by the NUMBER, such that if B1 is 4, then in C1 I want to display the text from A4, if B2 is 8, I want to display text from A8. Is it possible to set up a macro to utilize that? -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro - save to current location vs excel default location | Excel Discussion (Misc queries) | |||
Macro location?? | Excel Discussion (Misc queries) | |||
How to call a macro at another location | Excel Discussion (Misc queries) | |||
Macro Storage Location | Excel Discussion (Misc queries) | |||
macro help for changing data (cell location) in edit find box | Excel Discussion (Misc queries) |