I need assistance with a timer feature I have on a userform I created in Excel. I have cmd buttons: START, STOP, and RESET on the form that point to certain cells in order to activate the timer. START = A12, STOP= B12, and RESET= C12 (sheet: "Entry_Form" and the time in "h:mm:ss" format is displayed in D12 which populates my textbox= txtTime.
My issue is that the timer works intermittently and I don't know how to correct it or better yet figure out what's causing it to work sometimes and not others. When I say that it doesn't work I'm meaning that the "txtTime" field doesn't populate and refresh real time once the timer is started. I see it working fine on the worksheet in the desginated cells but not on the form.
There's 3 pieces of code that makes the timer work:
In the "Workbook":
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.OnTime Now + TimeValue("00:00:01"), "UpdateTimer"
If ActiveCell.Address = "$A$12" Then
Range("D12").Value = Range("D12").Value + 1 / 86400
ElseIf ActiveCell.Address = "$B$12" Then
ElseIf ActiveCell.Address = "$C$12" Then
Range("D12").Value = 0
' code updates txtTime field on form to proper format
Private Sub txtTime_Change()
frmCFSTracker.txtTime = Format(Worksheets("entry_form").Range("d12"), "hh:mm:ss")
Control source for "txtTime"= "D12"
NOTE: When the workbook 1st opens, I enable Macros and select it as a trusted source but no matter what the timer may work or may not work.
Thank you for your help!