H
Howard
Overlooking the obvious again, I suppose.
This used to work just fine. I dug it out of my archive to adapt to another use and its a no go.
If it type in Don, Bob or Kim into B1 - Enter nothing happens. It does not add and name the three ranges and of course then it will not GoTo any of them either.
I have confidence in the code as I believe I got help with it here from Claus or Garry.
Code is in sheet 1 module.
(And tried it in a standard module also, same no-go)
I tried it a couple times with EnableEvents = True to assure that was not the problem, no help there.
Thanks.
Howard
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = True
Dim TheDon As Range, TheKim As Range, TheBob As Range
If Target.Address <> "$B$1" Then Exit Sub
ActiveWorkbook.Names.Add Name:="TheDon", _
RefersTo:=Sheets("sheet1").Range("C110")
ActiveWorkbook.Names.Add Name:="TheKim", _
RefersTo:=Sheets("sheet2").Range("E1:F10")
ActiveWorkbook.Names.Add Name:="TheBob", _
RefersTo:=Sheets("sheet3").Range("G1:H10")
Select Case Target.Value
Case Is = "Don"
Application.Goto "TheDon"
MsgBox "Don's stuff"
Case Is = "Kim"
Application.Goto "TheKim"
MsgBox "Kim's stuff"
Case Is = "Bob"
Application.Goto "TheBob"
MsgBox "Bob's stuff"
Case Is = " "
MsgBox "Blank (space) stuff"
End Select
End Sub
This used to work just fine. I dug it out of my archive to adapt to another use and its a no go.
If it type in Don, Bob or Kim into B1 - Enter nothing happens. It does not add and name the three ranges and of course then it will not GoTo any of them either.
I have confidence in the code as I believe I got help with it here from Claus or Garry.
Code is in sheet 1 module.
(And tried it in a standard module also, same no-go)
I tried it a couple times with EnableEvents = True to assure that was not the problem, no help there.
Thanks.
Howard
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = True
Dim TheDon As Range, TheKim As Range, TheBob As Range
If Target.Address <> "$B$1" Then Exit Sub
ActiveWorkbook.Names.Add Name:="TheDon", _
RefersTo:=Sheets("sheet1").Range("C110")
ActiveWorkbook.Names.Add Name:="TheKim", _
RefersTo:=Sheets("sheet2").Range("E1:F10")
ActiveWorkbook.Names.Add Name:="TheBob", _
RefersTo:=Sheets("sheet3").Range("G1:H10")
Select Case Target.Value
Case Is = "Don"
Application.Goto "TheDon"
MsgBox "Don's stuff"
Case Is = "Kim"
Application.Goto "TheKim"
MsgBox "Kim's stuff"
Case Is = "Bob"
Application.Goto "TheBob"
MsgBox "Bob's stuff"
Case Is = " "
MsgBox "Blank (space) stuff"
End Select
End Sub