Public début
Public prochainchrono
Public chrono
Sub majchrono()
[COLOR=blue][B]Dim x%[/B][/COLOR]
temp = chrono / 3600
Sheets("feuil1").[b5] = Format(temp / 24, "hh:mm:ss")
chrono = chrono + 1
prochainchrono = Now + TimeValue("00:00:1")
If prochainchrono = début + TimeValue("02:00:00") Then
MsgBox "fin du temps réglementaire.", [B][COLOR=blue]vbCritical[/COLOR][/B]
[B][COLOR=blue]For x = 1 To 5000[/COLOR][/B]
[B][COLOR=blue]Beep[/COLOR][/B]
[B][COLOR=blue]Next[/COLOR][/B]
Exit Sub
End If
Application.OnTime prochainchrono, "majchrono"
End Sub
Sub auto_close()
On Error Resume Next
Application.OnTime prochainchrono, procedure:="majchrono", schedule:=False
End Sub
Sub demarre()
If Sheets("feuil1").[b5].Value > 0 Then
Sheets("feuil1").[b5].Value = 0
Exit Sub
End If
début = Now
chrono = 0
majchrono
End Sub