View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default Linking to an active cell

Put this code into the worksheet module ... (right click worksheet tab
select View Code)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 And Target.Row = 1 And Target.Row <= 20 Then
Range("C1") = ActiveCell.Value
End If
End Sub

--
Cheers
Nigel



"Sandip" wrote in message
oups.com...
Hi,

I have a range of cells say from A1 to A20 having certain numbers. I
would like the output of any of these cell range in C1 depending on
what the active cell is. The active cell will always be one cell and
not a range of cells.

For eg, If the active cell is A5, the value of A5 should appear in C1.
As the person presses the down arrow and scroll downs the list, the
number in C1 should change accordingly.

The output in C1 is supposed to drive various Vlookup formulas.

If the active cell is no longer within the A1 to A20 range, the last
selected cell in A1 to A20 should remain in C1.

Appreciate anyone's help..

Thanks
Sandip.