Hello,
Currently, I have a userform that runs a timer upon clicking 'Start' and stops once 'Stop' is pressed. Once stopped, another userform asking for additional information about the timed session will display and be recorded onto the Excel sheet. My problem is that when the timer is running, users cannot edit other workbooks that they have open. Does anybody have another way of doing this that would allow users to edit other workbooks while this loop is running? Here is the code for it:
Dim dteStart As Date, dteFinish As Date
Dim dteStopped As Date, dteElapsed As Date
Dim boolStopPressed As Boolean, boolResetPressed As Boolean
Private Sub btnReset_Click()
dteStopped = 0
dteStart = 0
dteElapsed = 0
Label1 = "0:00:00"
boolResetPressed = True
End Sub
Private Sub btnStart_Click()
btnstart.Enabled = False
btnstop.Enabled = True
Start_timer:
dteStart = time
boolStopPressed = False
boolResetPressed = False
Timer_Loop:
DoEvents
dteFinish = time
dteElapsed = dteFinish - dteStart + dteStopped
If Not boolStopPressed = True Then
Label1 = WorksheetFunction.Text(dteElapsed, "[h]:mm:ss")
If boolResetPressed = True Then GoTo Start_timer
GoTo Timer_Loop
Else
Exit Sub
End If
End Sub
Private Sub btnStop_Click()
ActiveWorkbook.Save
ManualReportUF2.Show
boolStopPressed = True
dteStopped = dteElapsed
Call btnReset_Click
btnstart.Enabled = True
btnstop.Enabled = False
Call UserForm_Initialize
ActiveWorkbook.Save
End Sub
Private Sub UserForm_Initialize()
Label1 = "0:00:00"
btnstop.Enabled = False
End Sub
Bookmarks