Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Linking to an active cell

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Linking to an active cell


This goes in worksheet code page, after you have entered a value if you
move the cursor back to the cell the value is displayed in c1, i didnt
have time to test it properly but it should work!

HTH

Simon

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Range("A1:A20")
For Each cell In rng
Range("C1").Value = ActiveCell.Value
Next

End Sub


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=394480

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Linking to an active cell

Hi Simon,

I have used your code and it does work however I have one problem. The
below macro is picking up the all the active cells and copying it in J5
even if its not within the range B8:B30.

What extra code do I need to add so that if any cell other than the
range is active, the same should not be pasted in J5.

Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Range("b8:b30")
For Each cell In rng
Range("j5").Value = ActiveCell.Value
Next
End Sub

Regards
Sandip.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Linking to an active cell


Go with Nigel's code it's better


--
Dnereb
------------------------------------------------------------------------
Dnereb's Profile: http://www.excelforum.com/member.php...o&userid=26182
View this thread: http://www.excelforum.com/showthread...hreadid=394480



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
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
set the background color of the current cell(active cell) kang New Users to Excel 2 July 31st 07 04:48 PM
referring to formula in a non active cell from active cell nickname Excel Discussion (Misc queries) 1 June 21st 07 12:11 PM
HOW TO COPY 480 ACTIVE E-MAIL ADDRESSES CLM "G" ON AN ACTIVE EXCE. ragman10 Excel Discussion (Misc queries) 1 December 13th 04 11:52 PM
Select First Active Cell if the cell is in a pivot table Don Excel Programming 0 June 30th 04 01:53 PM


All times are GMT +1. The time now is 05:57 AM.

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

About Us

"It's about Microsoft Excel"