Option Explicit
Dim Mem_Target As Range, Bloque_Selection As Boolean
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Mem_Target Is Nothing Then Bloque_Selection = True
If Not Application.Intersect(Target, Range("a1:z10000")) Is Nothing Then
Cancel = True
MsgBox "C'est un double clic sur la cellule " & Target.Address, vbOKOnly + vbInformation
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Mem_Target Is Nothing Then Bloque_Selection = True
If Not Application.Intersect(Target, Range("a1:z10000")) Is Nothing Then
Cancel = True
If Target.Count = 1 Then
MsgBox "C'est un clic droit sur la cellule " & Target.Address, vbOKOnly + vbInformation
Else
MsgBox "C'est un clic droit sur les cellules " & Target.Address, vbOKOnly + vbInformation
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set Mem_Target = Target
Application.OnTime Now() + TimeValue("00:00:01"), "'" & ThisWorkbook.Name & "'!" & ThisWorkbook.Worksheets(ActiveSheet.Name).CodeName & ".Differe_Worksheet_SelectionChange"
End Sub
Private Sub Differe_Worksheet_SelectionChange()
DoEvents
If Bloque_Selection Then Bloque_Selection = False: Set Mem_Target = Nothing: Exit Sub
If Mem_Target.Count = 1 Then
MsgBox "Worksheet_SelectionChange, je m'exécute sur la cellule " & Mem_Target.Address
Else
MsgBox "Worksheet_SelectionChange, je m'exécute sur les cellules " & Mem_Target.Address
End If
Set Mem_Target = Nothing
End Sub