View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Select case target.address

Hi Howard,

Am Sat, 26 Aug 2017 16:52:37 -0700 (PDT) schrieb L. Howard:

For the cells I13:I18, in a SelectionChange event macro, what would the select case syntax look like for...

If I13 is selected on the sheet then the Named Range ABC is selected (highlighted)
It I14 is selected on the sheet then select the Named Range DEF is selected (highlighted).


try:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("I13:I18")) Is Nothing _
Or Target.Count 1 Then Exit Sub

Select Case Target.Address(0, 0)
Case "I13"
Application.Goto Range("ABC")
Case "I14"
Application.Goto Sheets("Sheet1").Range("DEF")
Case "I15"
Application.Goto Sheets("Sheet1").Range("GHI")