Chronomêtre sous excel

Résolu/Fermé
eimoju Messages postés 2 Date d'inscription lundi 20 novembre 2017 Statut Membre Dernière intervention 21 novembre 2017 - 20 nov. 2017 à 12:58
Mike-31 Messages postés 18313 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 - 21 nov. 2017 à 15:30
Bonjour,

Je viens de faire ce chronométré sur une feuille excel , mais je voudrai que quand je clique sur stop il se remette à o

Option Explicit

Dim ChronoEnCours As Boolean, Pause As Boolean
Dim Depart As Double, Temps As Double

Private Sub CommandButton1_Click()
' Bouton Marche

ChronoEnCours = True
Depart = [now()]
Range("A4") = "00:00"
Chrono
End Sub

'Sub Compteur()
'Static S As Integer
' Do While Arret
' DoEvents
' If S <> Timer - T Then
' S = Timer - T
' [A4].Value = S
' End If
' Loop
'End Sub

Private Sub CommandButton2_Click()
' Bouton stop
ChronoEnCours = False
Pause = False
CommandButton3.Caption = "PAUSE"
End Sub

Private Sub CommandButton3_Click()
' Bouton Pause
If Pause = True Then
Pause = False
CommandButton3.Caption = "PAUSE"
Depart = [now()] - Temps
ElseIf ChronoEnCours Then
Pause = True
CommandButton3.Caption = "CONTINUE"
End If
End Sub

Sub Chrono()
Do While ChronoEnCours = True
If Pause = False Then
Temps = [now()] - Depart
End If
'Range("A4") = Format(Temps, "mm:ss,00")
Range("A4") = Temps
DoEvents
Loop
End Sub

merci par avnce

A voir également:

2 réponses

Mike-31 Messages postés 18313 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 5 073
20 nov. 2017 à 21:52
Bonsoir,

regarde comme cela

https://www.cjoint.com/c/GKuu0AjFLzj
1
eimoju Messages postés 2 Date d'inscription lundi 20 novembre 2017 Statut Membre Dernière intervention 21 novembre 2017
21 nov. 2017 à 13:22
Bonjour Mike-31
Merci pour ta réponse s'est juste ce qu'il me fait.

Merci beaucoup
0