Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 2,824
Default 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   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 2,824
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
Macro location?? SpeedyR Excel Discussion (Misc queries) 0 September 4th 08 10:52 PM
How to call a macro at another location Tom Excel Discussion (Misc queries) 1 December 23rd 07 01:14 AM
Macro Storage Location Richard Excel Discussion (Misc queries) 1 September 18th 07 02:48 AM
macro help for changing data (cell location) in edit find box Jim Excel Discussion (Misc queries) 1 November 10th 06 10:57 PM


All times are GMT +1. The time now is 07:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"