Hi All
I am trying to create a visual dashboard for cleaning times on some equipment at work, I have one working as i want it and moved onto the second one but when i input the data the timers for both start going super fast!
The way it should work is the user opens the form and selects the check box against which the item that has been cleaned. this should then set the timer to 10mins and start it. This works ok if only one timer is selected but if both are the timer runs fast, what we should be able to do is select any number of check boxes and or go back to the form and enter another item.
Timer Code
Sub starttimer()
Application.OnTime Now + TimeValue("00:00:01"), "D56timer"
Application.OnTime Now + TimeValue("00:00:01"), "D57timer"
End Sub
Sub D56timer()
If Sheet1.Range("B1") = Sheet1.Range("B2") Then Exit Sub
Sheet1.Range("B1").Value = CDate(Sheet1.Range("b1").Value) + TimeValue("00:00:01")
Sheet1.Range("B1").Value = Application.WorksheetFunction.Text(Sheet1.Range("B1").Value, "[h]:mm:ss")
Sheet1.Range("C1").NumberFormat = "[ss]"
starttimer
End Sub
Sub D57timer()
If Sheet1.Range("B4") = Sheet1.Range("B5") Then Exit Sub
Sheet1.Range("B4").Value = CDate(Sheet1.Range("b4").Value) + TimeValue("00:00:01")
Sheet1.Range("B4").Value = Application.WorksheetFunction.Text(Sheet1.Range("B4").Value, "[h]:mm:ss")
Sheet1.Range("C4").NumberFormat = "[ss]"
starttimer
End Sub
Sub stoptimer()
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:01"), "D56timer", , False
Application.OnTime Now + TimeValue("00:00:01"), "D57timer", , False
End Sub
Data transfer code
Private Sub CommandButton1_Click()
Dim TR As Long
TR = Sheet4.Range("B4").Value + 1
Sheet3.Range("Data_Start").Offset(TR, 0).Value = Label10
Sheet3.Range("Data_Start").Offset(TR, 1).Value = Label9
'D56
If Chk_D56CIP.Value = True Then
Sheet1.Range("B1").Value = "00:00:00"
Sheet3.Range("Data_Start").Offset(TR, 3).Value = "CIP"
Sheet3.Range("Data_Start").Offset(TR, 2).Value = Label1
Sheet3.Range("N2").Value = "00:10:00"
Call D56timer
End If
'D57
If Chk_D57CIP.Value = True Then
Sheet1.Range("B4").Value = "00:00:00"
Sheet3.Range("Data_Start").Offset(TR, 3).Value = "CIP"
Sheet3.Range("Data_Start").Offset(TR, 2).Value = Label1
Sheet3.Range("N3").Value = "00:10:00"
Call D57timer
End If
Unload UserForm1
End Sub
Bookmarks