Ah... I think I see why VLookup wouldn't work for you, since you need the latest timestamp and could have multiple options.
Maybe give this a shot?
Option Explicit
Dim lngOne, lngTwo, lngLatest, lngLastRow As Long
Dim strIP As String
Sub IPFinder()
lngLastRow = Workbooks(Book1).Worksheets(1).Cells(1048576, 1).End(xlUp).Row
For lngOne = 1 To lngLastRow
strIP = Workbooks(Book1).Worksheets(1).Cells(lngOne, 1)
Workbooks(Book1).Worksheets(1).Cells(lngOne, 3) = TimeTester(strIP)
Next
End Sub
Function TimeTester(strIP As String) As String
For lngTwo = 1 To lngLastRow
If Workbooks(book2).Worksheets(1).Cells(lngTwo, 2) = strIP Then
If lngLatest = 0 Or Workbooks(book2).Worksheets(1).Cells(lngLatest, 5) _
<= Workbooks(book2).Worksheets(1).Cells(lngTwo, 5) Then
lngLatest = lngTwo
End If
End If
Next
TimeTester = Workbooks(book2).Worksheets(1).Cells(lngLatest, 5)
End Function
Not sure how the time factor will work out for you. There are probably more elegant ways to do it, but this should be a workable brute-force option once everything's put in.
Bookmarks