This code takes the Upload info and adds it to the Tracker Sheet. Check it over and see if it works for you.
Sub AddUpload2Tracker()
Dim wb As Workbook, rg As Range
Dim nLastUploadRow As Long, nUploadRow As Long
Dim nEmpCode As Long, dtStartDOL As Date, dtEndDOL As Date, sType As String
Dim nDay As Long, nTrackRow As Long, dt As Date
Set wb = ThisWorkbook
With wb.Worksheets("Upload")
nLastUploadRow = .Cells(.Rows.Count, "A").End(xlUp).Row
' Emp.Codes begin on row 3
For nUploadRow = 3 To nLastUploadRow
nEmpCode = .Cells(nUploadRow, "B")
dtStartDOL = .Cells(nUploadRow, "D")
dtEndDOL = .Cells(nUploadRow, "E")
sType = .Cells(nUploadRow, "F")
Set rg = wb.Worksheets("Tracker").Cells.Find(nEmpCode)
If rg Is Nothing Then
MsgBox "Could not locate " & nEmpCode
Else
nTrackRow = rg.Row
dt = dtStartDOL
Do
nDay = Day(dt)
'Day one on the Tracker Sheet is column "C" = 3
wb.Worksheets("Tracker").Cells(nTrackRow, nDay + 2) = sType
'if day is end of month then exit do
If dt = DateSerial(Year(dtStartDOL), Month(dtStartDOL) + 1, 0) Then Exit Do
'Add one day to "dt"
dt = DateAdd("d", 1, dt)
Loop While (Day(dt) <= Day(dtEndDOL))
End If
Next nUploadRow
End With
End Sub
Bookmarks