Link to home
Start Free TrialLog in
Avatar of Nirvana
NirvanaFlag for India

asked on

time study/ Employee monitoring

i am to create a report for management on activities where employees are spending time.

Looking for solution where it records time for each activity a start stop pause button, I have a below macro when i double click on the activity time starts and when i click on time it stops

something like "http://baralga.github.io/"

I cannot use third party softwares in my company

Public stopMe As Boolean
Public resetMe As Boolean
Public myVal As Variant

Private Sub Worksheet_Activate()

End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 5 Then
        If Target.Value = myVal And Target.Value <> "" Then
            'Changed
            Dim startTime, finishTime, totalTime, timeRow
            startTime = Timer
            stopMe = False
            resetMe = False
            myTime = Target.Offset(, 2).Value
            Target.Offset(, 1).Select
startMe:
            DoEvents
            timeRow = Target.Row
            finishTime = Timer
            totalTime = finishTime - startTime
            Target.Offset(, 1).Value = Format(myTime + totalTime, "0.0000") & " Seconds"
            If resetMe = True Then
                Target.Offset(, 1).Value = 0
                Target.Offset(, 2).Value = 0
                stopMe = True
            End If
            If Not stopMe = True Then
                Target.Offset(, 2).Value = totalTime
                GoTo startMe
            End If
            Cancel = True
            End
        Else
            'Not Changed
            stopMe = True
            Cancel = True
        End If
    End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    myVal = Target.Value
End Sub

Open in new window

Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

I have some code at home that allows multiple timers on a userform. I'll have a look this evening if it helps.
Avatar of Nirvana

ASKER

Thank you Roy, that should help
Avatar of Nirvana

ASKER

Hi Roy_Cox, sir any update
Sorry, I finished late last night. I'll try to find the code this evening.
Avatar of Nirvana

ASKER

Sure no problem.. thanks again
ASKER CERTIFIED SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nirvana

ASKER

No problem Roy...you can provide when you find it....I will try with the one you have attached
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.