Hello there
I have written a basic open ended timer below that I connected to 4 buttons, a start and end plus the production and meeting. This can obviously be expanded to a bunch other states as well, as you require.
This creates a new record and you will have to use formula to calculate the elapsed time between different activities, making the assumption that while the clock is running, the last activity is continuing.
' global variables -----------
Public timer As Date
Public activity As Variant
' ----------------------------
Sub startClock()
If timer = "0" Then
timer = Now()
activity = "start clock"
write_record
Else: MsgBox ("timer already started")
End If
End Sub
Sub production()
activity = "production"
timer = Now()
write_record
End Sub
Sub meeting()
activity = "meeting"
timer = Now()
write_record
End Sub
Sub stopclock()
activity = "stopped"
timer = Now()
write_record
End Sub
Sub write_record()
Sheets(2).Select
ActiveCell.Value = timer
ActiveCell.Offset(0, 1).Value = activity
ActiveCell.Offset(1, 0).Activate
End Sub
Regards
Bookmarks