View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
external usenet poster
 
Posts: 703
Default I need an expert for that!

I presume your date/time stamp is in column "A", On/Off and number of minutes
(which I didn't need, as long as timestamps always occur in pairs) are in
columns "B" and "C". I put the output in columns "D" and "E", but guess
what? It failed on the 26th when there was a clock-out then a clock-in. I
ended up with two records for that day, but if this can get you started maybe
you can fix it.

That's all the time I can spend on this problem. Hope it helps.

Dim iRow As Long
Dim iBeg As Long
Dim iEnd As Long
Dim iStart As Long
Dim iStop As Long
Dim iTime As Long
Dim NewRow As Long
Dim LastRow As Long

LastRow = 10 ' find last row in column "A"

For iRow = 1 To LastRow Step 2

iBeg = DateDiff("n", 0, Format(Cells(iRow, 1), "dd-mm-yyyy hh:mm:ss"))
iEnd = DateDiff("n", 0, Format(Cells(iRow + 1, 1), "dd-mm-yyyy hh:mm:ss"))
iStart = (iBeg \ 1440 + 1) * 1440
iStop = (iEnd \ 1440 - 1) * 1440

NewRow = NewRow + 1
Cells(NewRow, 4) = DateAdd("n", iBeg, 0)
Cells(NewRow, 4).NumberFormat = "dd-mm-yyyy"
Cells(NewRow, 5) = iStart - iBeg

If iStop iBeg Then
For iTime = iStart To iStop Step 1440
NewRow = NewRow + 1
Cells(NewRow, 4) = DateAdd("n", iTime, 0)
Cells(NewRow, 4).NumberFormat = "dd-mm-yyyy"
Cells(NewRow, 5) = 1440
Next iTime
NewRow = NewRow + 1
Cells(NewRow, 4) = DateAdd("n", iEnd, 0)
Cells(NewRow, 4).NumberFormat = "dd-mm-yyyy"
Cells(NewRow, 5) = iEnd - iStop - 1440
End If

Next iRow


"mhax" wrote:


No one got a solution?


--
mhax
------------------------------------------------------------------------
mhax's Profile: http://www.excelforum.com/member.php...o&userid=36450
View this thread: http://www.excelforum.com/showthread...hreadid=562438