Hey guys... my script is doing weird things and can't workout why!
What is happening when ALL rows = correct criteria and the email function triggers it's actually placing "DONE" against all lines... instead of just that Row (i).... and moving down to the next.
The thing is I'm only saying to do this in "E" as a once off so I can't workout the function.
What is happening when ALL rows = correct criteria and the email function triggers it's actually placing "DONE" against all lines... instead of just that Row (i).... and moving down to the next.
The thing is I'm only saying to do this in "E" as a once off so I can't workout the function.
Code:
Sub SendMail()
Dim i As Long
Dim lastrow As Integer
lastrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Sheets("Sheet1").Select
For i = 4 To lastrow
If Sheets("Sheet1").Range("D" & i).Value <= 7 Then
Sheets("Sheet1").Range("E" & i).Value = "DONE"
ActiveWorkbook.FollowHyperlink "mailto:" & Cells(i, 1) & _
"?Subject=Shed to be delivered shortly&Body=Dear " & _
Cells(i, 2) & ", Your shed has been scheduled for DELIVERY within the next 7 DAYS if you need to make any changes to please please contact xxx immediately on (02) xxx The delivery date is " & _
Cells(i, 3) & "."
End If
next i