Bonjour
Remplacez les deux codes par ceux-ci
1. Ouverture
Private Sub Workbook_Open()
Dim lig As Integer, dlg As Integer
With Sheets(1)
lig = 5
dlg = Range("A" & Rows.Count).End(xlUp).Row
If dlg < 5 Then lig = 5 Else: lig = dlg + 1
.Range("A" & lig) = Format(Now, "hh:mm:ss")
End With
End Sub
2. Fermeture
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim lig As Integer, dlg As Integer
With Sheets(1)
lig = 5
dlg = Range("A" & Rows.Count).End(xlUp).Row
If dlg < 5 Then lig = 5 Else: lig = dlg + 1
.Range("A" & lig) = Format(Now, "hh:mm:ss")
End With
With ThisWorkbook
Application.DisplayAlerts = False
.Save
End With
End Sub
Cordialement