Option Explicit
Dim Start As Single
Private Sub CommandButton1_Click()
Dim H As Single
Dim M As Single
Dim S As Single
Dim Stp As Single
Start = Timer
Do
Stp = Timer - Start
H = Int(Stp / 3600)
M = Int((Stp - H * 3600) / 60)
S = Stp - H * 3600 - M * 60
Label1.Caption = Format(H, "00") & ":" & Format(M, "00") & ":" & Format(S, "00.0")
DoEvents
Loop While Start > 0
End Sub
Private Sub CommandButton2_Click()
Start = 0
End Sub
Private Sub UserForm_Activate()
Label1.Caption = ""
CommandButton1.Caption = "Start"
CommandButton2.Caption = "Stop"
End Sub
Do powyższego kodu chciałbym dodać jeszcze CommandButton3. Po kliknięciu CommandButton1 rozpoczyna się odliczanie czasu, po kliknięciu CommandButton2 następuje jego zatrzymanie. Powiedzmy, że czas zatrzymał się na 00:00:10,5. Po kliknięciu CommandButton3 liczenie czasu miałoby rozpocząć się ponownie, aczkolwiek od momentu, w którym zostało zatrzymane, czyli 00:00:10,5.
Poproszę o pomoc w tej kwestii. ;)