Combiné 2 beforedoubleclic ???

Bonjour le forum.

Voila ma question est très claire. Comment combiné c'Est deux formules (je suis incapable de mettre 2 beforedoubleclic dans la meme feuil.

A,b,c,Dcoche sont des nom défini.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Range("Acoche, Bcoche"), Target) Is Nothing Then Exit Sub
If IsEmpty(Target) Then
    Target = "X"
    Cancel = True
   Else
If Target = "X" Then
    Target = "R"
    Cancel = True
  End If
End If
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Range("Ccoche, Dcoche"), Target) Is Nothing Then Exit Sub
If IsEmpty(Target) Then
    Target = "X"
    Cancel = True
   Else
If Target = "X" Then
    Target = "D"
    Cancel = True
  End If
End If
End Sub

Merci d'avance a tous ceux qui pourront m'aider!

Peri

Bonsoir,

essaie avec ce code :

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Union(Range("Acoche"), Range("Bcoche")), Target) Is Nothing Then
    If IsEmpty(Target) Then
        Target = "X"
    ElseIf Target = "X" Then
        Target = "R"
    End If
    Cancel = True
ElseIf Not Intersect(Range("Ccoche, Dcoche"), Target) Is Nothing Then
    If IsEmpty(Target) Then
        Target = "X"
    ElseIf Target = "X" Then
        Target = "D"
    End If
    Cancel = True
End If
End Sub

Nickel, Merci beaucoup Felix

Voici le code final, qui pemet de créé une sorte de boucle ^^

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Range("Acoche, Bcoche"), Target) Is Nothing Then
    If IsEmpty(Target) Then
        Target = "X"
    ElseIf Target = "X" Then
        Target = "R"
    ElseIf Target = "R" Then
        Target = ""
    End If
    Cancel = True
ElseIf Not Intersect(Range("Ccoche, Dcoche"), Target) Is Nothing Then
    If IsEmpty(Target) Then
        Target = "X"
    ElseIf Target = "X" Then
        Target = "D"
    ElseIf Target = "D" Then
        Target = ""
    End If
    Cancel = True
End If
End Sub
2facture.xlsx (81.14 Ko)
Rechercher des sujets similaires à "combine beforedoubleclic"