Changing Cell Value

Yogi

Board Regular
Joined
Oct 21, 2002
Messages
74
I have numerical values in an array of cells (say from A1:A25). As I click on any of these cells in the array I want the value of that particular cell to display in cell D1. When a different cell is selected the display changes in cell D1. Is this possible?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,257
Sounds like a worksheet selection event may do the trick. Right click on your sheet tab, left click on View Code, and paste this in:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("A1:A25")) Is Nothing Then Range("D1").Value = ""
Range("D1").Value = Target.Value
End Sub

Any help?
 

Yogi

Board Regular
Joined
Oct 21, 2002
Messages
74
Mission Accomplished!
Thanks Tom!
On 2002-10-22 20:58, Tom Urtis wrote:
Sounds like a worksheet selection event may do the trick. Right click on your sheet tab, left click on View Code, and paste this in:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("A1:A25")) Is Nothing Then Range("D1").Value = ""
Range("D1").Value = Target.Value
End Sub

Any help?

[/quote]
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
Hi Yogi:

Welcome to the Board!

Tom Urtis gave you a VBA solution -- that may be a lot neater -- I am going to submit a non-vaba solution, a formula to be input in cell D1 ...

=IF(AND(CELL("col")=1,CELL("row")>=1,CELL("row")<26),CELL("contents"),"")

Regards!
(have we both not got an interesting first name)
Yogi Anand
 

Forum statistics

Threads
1,144,219
Messages
5,723,076
Members
422,477
Latest member
pete101

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top