I'm having a problem with the beforeDoubleClick routine below:
Private Sub worksheet_beforeDoubleClick(ByVal Target As Range, cancel As Boolean)
Dim doReturn As Boolean
doReturn = False
ActiveWorkbook.Names.Add Name:="rms", RefersToR1C1:= _
ActiveCell
With Target
If Not Intersect(.Cells, Me.Range("aq2:aq3")) Is Nothing Then
doReturn = True
If LCase(.Value) = False Then
.Value = True
Else
.Value = False
End If
End If
If Not Intersect(.Cells, Me.Range("at2:at24")) Is Nothing Then
doReturn = True
Call selectRoute
End If
If Not Intersect(.Cells, Me.Range("bd5:bd17")) Is Nothing Then
doReturn = True
Call selectSchool
End If
If doReturn Then
Application.Goto reference:="rms"
End If
End With
ActiveWorkbook.Names("rms").Delete
End Sub
I want it to record where the cursor is and place the range name "rms" in that location. Then it should evaluate the double-click location and take the indicated action - works fine by the way. Then the cursor should return to the "rms" location and delete that range name.
The "rms" range name is always attached to the cell that is double-clicked. I was under the impression that this type of code would fire prior to any double-click action.
Can any offer any suggestions as to where I went wrong?
TIA.
Bob
Bookmarks