Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On the active sheet that represents a given month of the year:
Column D = employee who has signed in Column E = Date in Column F = sign in time Column G = Date out Column H = sign out time Sarah 7/16/2014 9:44 PM 7/16/2014 10:22 PM Jaydee 7/16/2014 9:44 PM 7/16/2014 10:48 PM Frank 7/16/2014 10:51 PM Column M = A unique list of all employees. Employees will be signed in and out several times. Not every employee in column M will be signed in (some may not work that month) Some will be signed in but not signed out when the code is run during the course of the month. Trying to get this line to return all hours worked and minutes to the nearest 10th to column N next to employee name. ie. every 6 minutes = .1 of an hour. cM.Offset(, 1) = (cD.Offset(, 4) - cD.Offset(, 2)) + (cM.Offset(, 1)) So each time code is run, column N is cleared and all hours are updated. What I have right now is values that pretty much don't mean anything to me, and some are negative. Column N formatted as General until I know what it should be. I would expect the code to be run on the active sheet so it could used for all months, with each month on a sheet. Thanks, Howard Sub NameAndHours() Dim Mname As Range, Dname As Range Dim cM As Range, cD As Range Dim i As Long Set Mname = Range("M2:M" & Cells(Rows.Count, "M").End(xlUp).Row) Set Dname = Range("D2:D" & Cells(Rows.Count, "D").End(xlUp).Row) For Each cM In Mname For Each cD In Dname If cM = cD Then cM.Offset(, 1) = (cD.Offset(, 4) - cD.Offset(, 2)) + (cM.Offset(, 1)) End If Next Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
work hours with different hour prices | Excel Worksheet Functions | |||
Converting work hours to day/hours/minutes | Excel Discussion (Misc queries) | |||
Determining work hours between dates / hours | Excel Worksheet Functions | |||
total work hours for 24 hour on-call schedules | Excel Discussion (Misc queries) | |||
Apply a macro to all sheets - save me from hours and hours of work | Excel Programming |