ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Showing selected cell value (https://www.excelbanter.com/excel-programming/345057-showing-selected-cell-value.html)

Misssy

Showing selected cell value
 
Is there a way I can show in one cell the value of whatever cell is selected?

Ron de Bruin

Showing selected cell value
 
Hi Misssy

You can use the SelectionChange event

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Target.Value
End Sub

Read more about events on Chip Pearson's site.
http://www.cpearson.com/excel/events.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Misssy" wrote in message ...
Is there a way I can show in one cell the value of whatever cell is selected?




Bob Phillips[_6_]

Showing selected cell value
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("H1").Value = Target.Value
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Misssy" wrote in message
...
Is there a way I can show in one cell the value of whatever cell is

selected?



sebastienm

Showing selected cell value
 
In the sheet module, say you want the value to be displayed in cell A1:
'----------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("A1")
.Value = ActiveCell.Value
.NumberFormat = ActiveCell.NumberFormat
End With
End Sub
'---------------------------------------------------
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Misssy" wrote:

Is there a way I can show in one cell the value of whatever cell is selected?


Misssy

Showing selected cell value
 
Thanks - All options work great!

"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.Range("H1").Value = Target.Value
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Misssy" wrote in message
...
Is there a way I can show in one cell the value of whatever cell is

selected?





All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com