Good evening everyone,
I am new to this forum and I needed some help with a stopwatch, I know that one can make a stopwatch using excel, and I wanted it to store the time measured everytime I press "lap" button, can someone help me?
Thank you!!
Good evening everyone,
I am new to this forum and I needed some help with a stopwatch, I know that one can make a stopwatch using excel, and I wanted it to store the time measured everytime I press "lap" button, can someone help me?
Thank you!!
Code from one project :
Two workbooks attached :![]()
Public NextTime As Date Sub Start_Pause_Project() Dim NextRow As Long With Sheet1.Shapes("Rectangle 1") Select Case .TextFrame.Characters.Text Case "START" NextRow = Range("B" & Rows.Count).End(xlUp).Row + 1 Start_Clock With Range("B" & NextRow) .Value = Time .NumberFormat = "h:mm AM/PM" End With With Range("D" & NextRow) .Value = Date .NumberFormat = "d.mm.yy" End With .TextFrame.Characters.Text = "PAUSE" .Fill.ForeColor.SchemeColor = 52 'Orange Case "PAUSE" Stop_Clock .TextFrame.Characters.Text = "RESUME" .Fill.ForeColor.SchemeColor = 50 'Lime Green Case "RESUME" Start_Clock .TextFrame.Characters.Text = "PAUSE" .Fill.ForeColor.SchemeColor = 52 'Orange End Select End With End Sub Sub Stop_Project() Dim Lastrow As Long If Range("C3").Value > 0 Then Lastrow = Range("B" & Rows.Count).End(xlUp).Row Stop_Clock With Range("C" & Lastrow) .Value = Time .NumberFormat = "h:mm AM/PM" End With With Range("E" & Lastrow) .Value = Range("C3").Value .NumberFormat = "[h]:mm:ss" End With Range("C3").Value = 0 With Sheet1.Shapes("Rectangle 1") .TextFrame.Characters.Text = "START" .Fill.ForeColor.SchemeColor = 50 'Lime Green End With End If End Sub Private Sub Start_Clock() NextTime = Now + TimeValue("00:00:01") Range("C3").Value = Range("C3").Value + TimeValue("00:00:01") Application.OnTime NextTime, "Start_Clock" End Sub Private Sub Stop_Clock() If NextTime > 0 Then Application.OnTime NextTime, "Start_Clock", Schedule:=False NextTime = 0 End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks