Changement de cellule au double click limité a une range

Bonjour j'ai mon code qui est ci dessosu mais je voudrai le limité à un tableau de range("E6:J13")

c'est possible ?

cordialement

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Application.EnableEvents = False
If Target.Value = "x" Then
    Target.Value = ""
    GoTo fin
End If
If Target.Value = "" Then Target.Value = "x"
fin:
Application.EnableEvents = True
End Sub

Bonjour,

Il suffit d'ajouter cette instruction à la première ligne

if Intersect(Target, Me.Range("E6:J13")) is Nothing   Then Exit Sub

Salut naubin,

Salut thev,

NOT ou pas NOT, that's the question...

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
'
Cancel = True
Application.EnableEvents = False
'
If Not Intersect(Target, Range("E6:J13")) Is Nothing Then Target = IIf(Target = "", "x", "")
'
Application.EnableEvents = True
'
End Sub

A+

j'ai la même chose à faire mais c'est quand je double click , je passe de C à NC et de NC à C

UP

Salut Naubin,

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
'
Cancel = True
Application.EnableEvents = False
'
If Not Intersect(Target, Range("E6:J13")) Is Nothing Then _
    If Target = "C" Or Target = "NC" Then Target = IIf(Target = "C", "NC", "C")
    If Target = "" Or Target = "x" Then Target = IIf(Target = "", "x", "")
'
Application.EnableEvents = True
'
End Sub

A+

Rechercher des sujets similaires à "changement double click limite range"