Thread: [Solved] Formula Help
View Single Post
 
Old 01-09-2015, 12:00 PM
charlesdh charlesdh is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

I modified your code see if this works.
Code:
Sub MOT()
Worksheets("MOT's DUE").Activate
For xRow = 6 To ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
expiry_date = Cells(xRow, 3).Value

    If (expiry_date - 28 <= Date) And Cells(xRow, 4).Text = "" Then '(Len(Cells(xRow, 4).Value < 4))) Then
        Cells(xRow, 4).Value = Date
        strVehicles = strVehicles & Cells(xRow, 1).Value & ", "
    End If
Next

strEmailAddress = "StephenODonnell@tfl.gov.uk; Declan.Russell@tfl.gov.uk; Rino.Marcangelo@tfl.gov.uk; Salina.Sandhu@tfl.gov.uk; Sandie.Charlton@tfl.gov.uk"
strSubject = "Vehicle MOT expiring soon"
email_body = "Hi all," & vbNewLine & vbNewLine & "the following vehicles MOT expires within next 28 days." & vbNewLine & vbNewLine & _
    strVehicles
Call SendeMail(strEmailAddress, "", "", strSubject, email_body)
End Sub
Reply With Quote