Hi lacke81c and welcome to ExcelForum,
When I tested the following macro, the data started in cell "A1" (date).
Option Explicit
Sub ProcessItemsFromAList()
Const nFileListHeaderROW = 0
Const FourMinutesWorthOfSEONDS = 4 * 60
Dim wb As Workbook
Dim ws As Worksheet
Dim myDeltaSeconds As Long
Dim myDate As Date
Dim myTime As Date
Dim myDateAndTime As Date
Dim myDateAndTimePrevious As Date
Dim iCount As Long
Dim iError As Long
Dim iErrorCount As Long
Dim iOutputRow As Long
Dim iRow As Long
Dim bNeedMore As Boolean
Dim sAction As String
Dim sDate As String
Dim sTime As String
Dim sUser As String
Dim sUserPrevious As String
Set wb = ThisWorkbook
Set ws = wb.ActiveSheet
'Initialize the Source Row
iRow = nFileListHeaderROW
'Loop until all matching files have been found
bNeedMore = True
While bNeedMore
'Debug.Print sPath & sFileName
'Increment the source row number
iRow = iRow + 1
'Get the data from the Row
sDate = ws.Cells(iRow, "A").Text
'Terminate if 'File Name' is blank
If Len(sDate) = 0 Then
bNeedMore = False
Else
myDate = 0
myTime = 0
myDateAndTime = 0
sTime = ws.Cells(iRow, "B").Text
sUser = ws.Cells(iRow, "C").Text
sAction = ws.Cells(iRow, "D").Text
If IsDate(sDate) Then
myDate = CDate(sDate)
End If
If IsDate(sTime) Then
myTime = CDate(sTime)
End If
myDateAndTime = myDate + myTime
Debug.Print iRow, myDateAndTime, sUser 'Write to Debugger Immediate Window (CTRL G)
If sUser = sUserPrevious Then
myDeltaSeconds = DateDiff("s", myDateAndTime, myDateAndTimePrevious)
Debug.Print "---------", myDeltaSeconds
If myDeltaSeconds < FourMinutesWorthOfSEONDS Then
Debug.Print "RED"
ws.Cells(iRow, "A").Interior.Color = RGB(255, 0, 0) 'Red
ws.Cells(iRow, "B").Interior.Color = RGB(255, 0, 0) 'Red
ws.Cells(iRow, "C").Interior.Color = RGB(255, 0, 0) 'Red
ws.Cells(iRow, "D").Interior.Color = RGB(255, 0, 0) 'Red
End If
End If
myDateAndTimePrevious = myDateAndTime
sUserPrevious = sUser
End If
Wend
'Clear object pointers
Set wb = Nothing
Set ws = Nothing
End Sub
Lewis
Bookmarks