Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
DerLig = Range("A" & Rows.Count).End(xlUp).Row
If DerLig < 3 Then DerLig = 3
If Not Intersect(Range("A3:A" & DerLig + 1), Target) Is Nothing Then
Cancel = True
Application.EnableEvents = False
If IsEmpty(Target) And Application.WorksheetFunction.CountIf(Range("A2:A" & DerLig), Format(Date, "dddd dd mmmm yyyy")) > 0 Then
MsgBox "Cette date existe déjà"
GoTo Sortie
End If
If Target <> "" And Not IsError(Application.Match(CSng(Date), Columns("G"), 0)) Then 'Normalement c'est cette ligne qui est la bonne pour indiquer la date du jour
' If Target <> "" And Not IsError(Application.Match(CSng(CDate(Trim(Mid(Target, InStr(Target, " "))))), Columns("G"), 0)) Then 'cette ligne en commentaire
If Target.Value <> "" Then
If MsgBox("Effacer la date?", vbYesNo) = vbYes Then
On Error Resume Next
Target.Resize(, 8).SpecialCells(xlCellTypeConstants, 23).ClearContents
On Error GoTo 0
Target.Resize(, 8).Interior.ColorIndex = 8
End If
End If
Else
Target.Offset(, 6).Value = Date
Target = Application.Proper(Format(Date, "dddd dd mmmm yyyy"))
End If
End If
Sortie:
Application.EnableEvents = True
Range("A1").Select
End Sub