You are on page 1of 2

Sub Start_timer()

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Timer")
sh.Range("Q1").Value = "Start"

If sh.Range("Q2").Value = "" Then


sh.Range("Q2").Value = Now

End If

x:

VBA.DoEvents

If sh.Range("Q1").Value = "stop" Then Exit Sub


sh.Range("Q3").Value = Now

GoTo x

End Sub

Sub Stop_timer()

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Timer")
sh.Range("Q1").Value = "Stop"

End Sub

Sub Reset_timer()

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Timer")
sh.Range("Q1").Value = "Stop"
sh.Range("Q2:Q3").ClearContents

End Sub

stop watch

Private Sub CommandButton1_Click()

a = True

Do While a

UserForm1.Label1.Caption = Format(DateAdd("s", 1, UserForm1.Label1.Caption),


"hh:mm:ss")

Wait = 1
Start = Timer

While Timer < Timer + Wait


DoEvents

Wend

Loop

End Sub

Private Sub CommandButton2_Click()

a = False

End Sub

You might also like