Hi,

I have an excel sheet which has names of employees in one column, their respective email ID's in one column, date the task was assigned to them in another column and one more column which gives the date by which they need to complete the task. I have also added another column in my excel which will calculate the difference in dates (which is 10).

What I am trying is, if the date exceeds the time limit (which is 10 days), an email should be sent to that employee. This should happen for any employee who has exceeded the date (time of 10 days).

I have written few codes, which are not giving the desired results. I will share what I have and would appreciate your valuable inputs to get my requirement complete.

Sub email()
 
Dim outapp As Object
Dim outmail As Object

 Sheets("Sheet1").Range("H2").Select
Range(Selection, Selection.End(xlDown)).Select
 
 'For Each wscell In Selection.Cells
 
  For Each cell In Range("H2:H3")
        If cell.Value > 10 Then
 
'If Range.Select > 10 Then
   Set outapp = CreateObject("Outlook.Application")
Set outmail = outapp.createitem(0)
With outmail
        .To = "[email protected]"
         .CC = ""
        .Subject = "ETA missed"
        .body = ""
        '.Attachments.Add ""
        .Send
       
End With
Set outapp = Nothing
Set outmail = Nothing
 End If
 Next
End sub