Bonjour le forum
Dans la macro ci-dessous je n'arrive pas à faire la distinction des couleurs au Double Click
Couleur de fond toujours 46
Il serait peut-être intéressant de passer par une couleur de fond au double click
1 Double Click =Oui = couleur de fond et couleur police
2 Double Click =Non = couleur de fond et couleur police
3 Double Click Retour couleur de fond sans écriture
Merci pour vos retours
Cordialement
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Init 'Module posologie
If Target.Column = 1 Then Target.Value = Date: Cancel = True
If Not Intersect(Range("C3:C" & Range("A" & Rows.Count).End(xlUp).Row), Target) Is Nothing Then
Cancel = True
If Range("A" & Target.Row) = "" Then
MsgBox "Double Click Cellule A3 pour Afficher la date"
Exit Sub
End If
Target = IIf(Target = "toto", "", "toto")
ElseIf Not Intersect(Range("B3:B" & Range("A" & Rows.Count).End(xlUp).Row), Target) Is Nothing Then
Cancel = True
Target = IIf(Target = NbAmpoule, "", NbAmpoule) 'NBAmpoule à la place de 1 à condition que le module Posologie soit présent
End If
If Target.Column = 9 And Target.Row >= 2 And Target.Row <= 106 Then
Application.EnableEvents = False
With ActiveCell.Offset(0, -8).Resize(1, 8)
.Font.Strikethrough = Not .Font.Strikethrough
ActiveCell = IIf(ActiveCell.Offset(0, -8).Font.Strikethrough, "Oui", "Non")
End With
With ActiveCell
If .Offset(0, -8) <> "" And .Offset(0, -8).Font.Strikethrough = True Then
.Interior.ColorIndex = 35
.Font.ColorIndex = 3
Else
.Interior.ColorIndex = 46
.Font.ColorIndex = 5
End If
End With
End If
Cancel = True
Application.EnableEvents = True
End Sub