Option Explicit 'facultatif, déclaration des variables obligatoire
Dim marche As Boolean 'mémorise la variable
Sub Stopper_Processus()
marche = False
End Sub
Sub Lancer_Processus()
If marche Then Exit Sub 'évite la relance de la macro quand elle tourne
Dim PauseTime, Start, n, t
marche = True
PauseTime = 0.5 '0,5 seconde
Do
If Not marche Then Exit Do 'sort de la boucle pour arrêter la macro
Start = Timer
n = n + 1
With Cells(n, 1) 'juste pour tester
.NumberFormat = "hh:mm:ss.00"
.Value = Start / 86400
End With
Do
DoEvents
t = Timer
Loop While IIf(t < Start, t + 86400, t) < Start + PauseTime 't < Start passé minuit
Loop
End Sub