I will put it out there that my VBA skills are nada. So I apologize if this is a basic question, as I have looked at different YouTube videos and excel forums and the examples they provided did not work when trying to write the code.
I need a VBA code for when the following words are entered into sheet 1, cells D11 and D13: New York, Kansas, and Ohio and their abbreviations NY, KS, and OH. I need 3 separate text pop-up's as each state has it's on specific instructions.
I have tried running macro, however, since it is dependent on so many variables, I could not find an appropriate macro code that encompassed what I needed.
I tried these codes below...and I as able to get code 1 to work, but when I tried to add more than just one "word" the code stopped working. And when I went back to the original code, for whatever reason it would not work again.
With code 2 I either get an error, or it does not work...
I am beyond frustrated at this point. :-(
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("D11:D13")) Is Nothing Then If Target = "Kansas" Then MsgBox "test 1." End If End If End Sub
Private Sub Worksheet_Change(ByVal Target As Range) If Not Range("D11:D13").Find(what:="Kansas", LookIn:=xlValues, lookat:=xlWhole, MatchCase:=True) Is Nothing Then MsgBox "test 1" End If End Sub
Code 1 worked initially, but after I tried adding more works and msg box scenarios it broke for whatever reason, even deleting and rewriting it, the code will not work now.
Code 2 either gives me a End Block error.