Hi,
This is the code you need in the code sheet of the worksheet on which you have your cell that needs to be monitored:
- Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then CheckEntry Target
End Sub
and this is the code that should be on a code module, Module1 by default:
- Code: Select all
Public Sub CheckEntry(ByRef Target As Range)
With Target.Worksheet.Range("A12")
If .Value = "CYTR" Then Target.Value = Range("A2").Value
If .Value = "BGTL" Then Target.Value = Range("A3").Value
End With
End Sub
I didn't understand what you mean by "etc." So, this code stops where your description stopped. Perhaps you can continue it yourself. Here is a little help to find your way in VBA in case you are very new to it:
Open the VB Editor window, either by pressing Alt+F11 or by selecting Tools / Macro / Visual Basic Editor from your CommandBar.
You should see the Project Explorer window on the left of the VBE window. It lists the open workbooks’ work and code sheets. If you don’t see it, open it by selecting View / Project Explorer or by pressing Ctrl+R.
To insert a code module right-click on the name of your VB Project (that is, the name of your workbook). In the dropdown that opens, select Insert / Module. It will be called Module1 by default if there aren’t any other modules with default names already.
Best of luck!
You do not have the required permissions to view the files attached to this post.
Have a great day!
Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)