bonsoir

j'ai trouver ce code sue le net pour afficher un chrono dans un formulaire
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Public ProchainChrono, Départ
Sub afficheForm()
   UserForm1.Show
End Sub
 
Sub majChrono()
 UserForm1.chrono.Caption = Format((Timer() - Départ) / 3600 / 24, "hh:mm:ss")
 ProchainChrono = Now + TimeValue("00:00:1")
 Application.OnTime ProchainChrono, "majChrono"
End Sub
 
Sub auto_close()
 On Error Resume Next
 Application.OnTime ProchainChrono, Procedure:="majChrono", Schedule:=False
End Sub
 
Private Sub B_demarre_Click()
 Départ = Timer()
 majChrono
End Sub
 
Private Sub b_arret_Click()
 On Error Resume Next
 Application.OnTime ProchainChrono, Procedure:="majChrono", Schedule:=False
End Sub
je l'ai adapté a mes besoins mais j'ai un soucis

j'ai besoin de plusieurs chrono sur le meme formulaire et cela ne fonctionne pas c'est a dire que quand je lance le premier chrono il démarre et quand je lance le deuixieme il demarre aussi mais fai recommancer au debut le premier

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
Sub afficheForm()
   UserForm1.Show
End Sub
 
Sub majChrono2()
 UserForm1.chrono2.Caption = Format((Timer() - Départ) / 3600 / 24, "hh:mm:ss")
 ProchainChrono = Now + TimeValue("00:00:1")
 Application.OnTime ProchainChrono, "majChrono2"
End Sub
 
Sub auto_close()
 On Error Resume Next
 Application.OnTime ProchainChrono, Procedure:="majChrono2", Schedule:=False
End Sub
 
Private Sub B_demarre_Click()
 Départ = Timer()
 majChrono2
End Sub
merci de m'aider svp