![]() |
Selected Cell equals x then..
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 -- Message posted from http://www.ExcelForum.com |
Selected Cell equals x then..
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 -- Regards Frank Kabel Frankfurt, Germany Fairly certain that if this is possible it would be done in VBA, however 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 currently has selected and then change the data in another cell based upon the selection. IE. If the user has cell B3 selected then I would like cell C4 to be populated with the message "You have B3 selected." If the user has cell A1 selected, then the same cell C4 would be populated with the message "You have A1 selected." Any help would be greatly appreciated. ~RBHicks --- Message posted from http://www.ExcelForum.com/ |
Selected Cell equals x then..
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 -----Original Message----- Fairly certain that if this is possible it would be done in VBA, however 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 currently has selected and then change the data in another cell based upon the selection. IE. If the user has cell B3 selected then I would like cell C4 to be populated with the message "You have B3 selected." If the user has cell A1 selected, then the same cell C4 would be populated with the message "You have A1 selected." Any help would be greatly appreciated. ~RBHicks --- Message posted from http://www.ExcelForum.com/ . |
Selected Cell equals x then..
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 -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 10:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com