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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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?
 
Upvote 0
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]
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,580
Members
449,089
Latest member
Motoracer88

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
Back
Top