Selected Cell equals x then..

C

CCManager

Fairly certain that if this is possible it would be done in VBA, howeve
very uncertain of how to approach this.

Here is what I am trying to accomplish.

I would like the worksheet to recognize what cell the user currentl
has selected and then change the data in another cell based upon th
selection.

IE. If the user has cell B3 selected then I would like cell C4 to b
populated with the message "You have B3 selected." If the user has cel
A1 selected, then the same cell C4 would be populated with the messag
"You have A1 selected."

Any help would be greatly appreciated.

~RBHick
 
F

Frank Kabel

Hi
can be done with a worksheet event (selection_change). Put the
following code in your worksheet module (not in a standard module):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Me.Range("C4").Value = "You have selected" & Target.Address
Application.EnableEvents = True
End Sub
 
F

Frank Stone

Open VB editor. In the project window(far left) select the
sheet you wish the message to appear. In left combo box
above the code window, click the down arrow and select
worksheet. in the right combo box above the code window,
select SelectionChange. In the code window enter this code:
Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
'MsgBox ("you have selected" & " " & ActiveCell.Address)
'or
Range("C4").FormulaR1C1 = "You have selected" & " " &
ActiveCell.Address
End Sub
 
C

CCManager

Thank you both for those solutions. This has now progressed int
something slightly different and after trying to modify your solution
above to make this work, still having issues.

What the desired result has now become...
If the user has cell M3 selected, then change cell S8 to show the dat
in cell K57. If the user has cell M5 selected, change cell S8 to sho
the data in cell K58...and so on.

Here is what I have that is not working.

Sub FieldTip()
If ActiveCell.Value = ("M3") Then Range("S8").Value = ("K57")
Else: If ActiveCell.Value = ("M5") Then Range("S8").Value
("K58")
Else: Range("S8").Value = " "
End If
End Sub

I attemped to first change the existing sub however it seems tha
Private Sub Worksheet_SelectionChange(ByVal Target As Range) will no
allow If Then statements. Might have been an error on my part whe
attempting to code however. Any help would be greatly appreciated.

~RBHick
 
Top