Try this
On Error GoTo cleanup
Dim PreAbsences As String, iRow As Long
For iRow = 4 To 75
PreAbsences = ""
For x = 9 To 33
Set Cell = Cells(iRow, x)
If Cell.Value = "X" Then
If Cell.Offset(, 2).Value = "sent" Then
PreAbsences = PreAbsences & "<br>" & Cells(3, Cell.Column).Value
Else
Cell.Offset(, 2).Value = "sent"
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.Display
.To = Cells(Cell.Row, "E")
.CC = Cells(Cell.Row, "F")
.Subject = "Absence " & Cells(3, Cell.Column) & " (" & Cells(Cell.Row, "C") & ")" 'subject line absence "date"(from selected cell) +individual from Cells(cell.Row, "A")
.HTMLBody = strbody & Cells(Cell.Row, "D") & "," & "<br><br>" & strbody1 & Cells(3, Cell.Column) & strbody2 & IIf(PreAbsences = "", "", "<br><br><br>Previous Absences" & PreAbsences) & .HTMLBody
PreAbsences = ""
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
End If
End If
Next
Next
y = 46
Bookmarks