Hi Casey,
That's great. A solution, and a learning experience<G.
Maybe you should add a computation of al the times, finish-start aggregated?
Do post back if you get stuck.
Bob
"caseyoconnor10 " wrote in
message ...
Bob,
Excellent...Just Excellent, that is all I can say. I ran with your code
and made a few modifications to completely fix my issue. Here is what I
did. Some employees take multiple breaks so the code needs to look for
more login logout times, therefore I stretched the .Resize to 60 which
expands the number of fields to the right. Then i also forgot the
employees name is also a field that sits to the left of the date field
so I shifted all the code to the right one cell. I was going to use
this code just for single employees, but I again made a different set
of changes and now I am able to fix all employees LoginLogout Times at
once. I want you to know you have really helped me excel in my VBA
knowledge, helped me resolve this current issue, and inspired me to
learn even further in the field of programming. This is the first of
two parts of my problem with login/logout times, however I am going to
try and come up with a solution for the second part on my own.....You
were a huge help...Thank you
Casey
Here is my end result:
Employee 06/01/04 6:49AM 8:20AM 8:35AM 9:45AM
10:30AM 1:41PM 1:59PM 3:16PM
Employee 06/02/04 6:52AM 8:18AM 8:34AM 9:57AM
10:45AM 1:31PM 1:46PM 3:15PM
Employee 06/03/04 6:52AM 8:18AM 8:33AM 10:18AM
Employee 06/04/04 6:49AM 8:19AM 8:35AM 9:45AM
10:31AM 1:32PM 1:47PM 3:15PM
Here is the changes I made below
Dim cLastRow As Long
Dim rng As Range
Dim i As Long
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
'The next line if set at 4 will make the 1st line of time return
For i = cLastRow To 3 Step -1
If Cells(i, "B").Value = Cells(i - 1, "B").Value Then
'.Offset moves the cell to the right 1 cell
'.Resize allows many cells to be opened at the right
Cells(i, "B").Offset(0, 1).Resize(1, 60).Copy _
Destination:=Cells(i - 1, "B").Offset(0, 5)
If rng Is Nothing Then
Set rng = Cells(i, "B")
Else
Set rng = Union(rng, Cells(i, "B"))
End If
End If
Next i
If Not rng Is Nothing Then
rng.EntireRow.Delete
End If
---
Message posted from http://www.ExcelForum.com/