Hyflex,
Didn't realize it was almost 400,000 rows O.o
Give this macro a try, let me know how it goes.
Sub tgr()
Dim wsAMO As Worksheet
Dim wsMDP As Worksheet
Dim rIndex As Long
Dim DataIndex As Long
Dim lDate As Long
Dim rngFound As Range
Dim strName As String
Dim strFirst As String
Dim arrData() As Variant
Set wsAMO = Sheets("AMOStaffList")
Set wsMDP = Sheets("MDPData")
arrData = wsAMO.Range("BY1:BZ" & wsAMO.Cells(Rows.Count, "A").End(xlUp).Row).Value
For rIndex = 1 To wsAMO.Cells(Rows.Count, "A").End(xlUp).Row
If Trim(wsAMO.Cells(rIndex, "A")) <> vbNullString Then
If Val(wsAMO.Cells(rIndex, "BW").Value) > 0 Then
strName = Evaluate("=Left(""" & wsAMO.Cells(rIndex, "A").Value & " " & """,Find("" "",""" & wsAMO.Cells(rIndex, "A").Value & " " & """)-1)")
lDate = Int(wsAMO.Cells(rIndex, "BW").Value2)
Set rngFound = wsMDP.Columns("F").Find(strName, , , xlWhole)
If Not rngFound Is Nothing Then
strFirst = rngFound.Address
Do While Not rngFound Is Nothing
If Int(wsMDP.Cells(rngFound.Row, "D").Value2) = lDate Then
arrData(rIndex, 1) = wsMDP.Cells(rngFound.Row, "H").Value
arrData(rIndex, 2) = wsMDP.Cells(rngFound.Row, "I").Value
Exit Do
End If
Set rngFound = wsMDP.Columns("F").Find(strName, rngFound, xlValues, xlWhole)
If rngFound.Address = strFirst Then Exit Do
Loop
strFirst = vbNullString
Set rngFound = Nothing
End If
End If
End If
Next rIndex
Range("BY1:BZ1").Resize(UBound(arrData, 1)).Value = arrData
End Sub
Bookmarks