XL 2010 case a cocher - modification de macro

jokerfidelio

XLDnaute Occasionnel
Bonjour à tous,

J’aimerais si possible modifier cette macro, qui d'ailleurs fonctionne êtres bien, mais je voudrais
modifier celle ci pour que quand je clic sur la cellule exemple en "F9" en parallele sur cette même ligne
AUTOMATIQUEMENT si "G9" est coché celle ci ce décoche automatiquement.

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  temp = Array("X", "")
  If Not Application.Intersect(Target, Range("F9:F17, G9:G17")) Is Nothing Then
    With Target
  p = Application.Match(Target, temp, 0)
  If Not IsError(p) Then
    If p = UBound(temp) + 1 Then p = 0
  Else
    p = 0
  End If
  Target = temp(p)
  Cancel = True
  End With
  End If
End Sub

merci a vous tous, pour toute l'aide que vous apportez !
 

mécano41

XLDnaute Accro
Bonjour,

Comme ceci peut-être...

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Coche As Range, Retour As Boolean)
If Not Application.Intersect(Coche, Range("F9:F17, G9:G17")) Is Nothing Then
  If Coche.Value = "X" Then
  Coche.Value = ""
  Else
  Coche.Value = "X"
  Coche.Offset(0, 1).Value = ""
  End If
End If
End Sub

Cordialement
 

Si...

XLDnaute Barbatruc
Bon_jour

avec réciprocité
VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal R As Range, Cancel As Boolean)
  If Not Application.Intersect(R, [F9:G17]) Is Nothing Then
    R = IIf(R = "", "X", "")
    If R.Column = 6 Then R(1, 2) = IIf(R = "", "X", "")
    If R.Column = 7 Then R(1, 0) = IIf(R = "", "X", "")
    [E9].Select
  End If
End Sub
 

jokerfidelio

XLDnaute Occasionnel
Bon_jour

avec réciprocité
VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal R As Range, Cancel As Boolean)
  If Not Application.Intersect(R, [F9:G17]) Is Nothing Then
    R = IIf(R = "", "X", "")
    If R.Column = 6 Then R(1, 2) = IIf(R = "", "X", "")
    If R.Column = 7 Then R(1, 0) = IIf(R = "", "X", "")
    [E9].Select
  End If
End Sub
Super, fonctionnel a 100% merci a vous tous
 

Discussions similaires

Réponses
2
Affichages
145

Statistiques des forums

Discussions
312 321
Messages
2 087 265
Membres
103 501
dernier inscrit
talebafia