Hi,
I want to run different macro when different range are double clicked. I'm fine with two events with If and ElseIf but I want to add a third event with a different range. Something like this :
Macro1 and Macro 2 run when I click the appropriate range but Macro3 isn't running when I click in "rangedoc". I'm sure I am not using the Else If Not properly.
Can you please help me with this issue.
Thank you.
I want to run different macro when different range are double clicked. I'm fine with two events with If and ElseIf but I want to add a third event with a different range. Something like this :
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
Cancel = True
Dim myRangedoc As Range
Set myRangedoc = Range("phonebookname")
If Not Intersect(Target, myRangedoc) Is Nothing Then
Macro1
ElseIf Not Intersect(Target, Range("rangefilter")) Is Nothing Then
If Not Intersect(Target, Range("Rangefilter")) Is Nothing Then
Macro2
ElseIf Not Intersect(Target, Range("rangedoc")) Is Nothing Then
If Not Intersect(Target, Range("rangedoc")) Is Nothing Then
Macro3
End If
End If
End If
End Sub
Can you please help me with this issue.
Thank you.