I have this code that sends an email if the certain conditional formatting conditions are met the code is below
If x - Cells(3, 4) > 30 Then
Dim i As Long
i = 7
'code to see if a relief valve has to be retested'
Do While Range("A" & i) <> IsBlank
If Range("L" & i) = "" Then 'If the cell is blank an email is not sent'
ElseIf Range("L" & i) <= (Date - 365 * (3 * Range("N" & i))) - 182 Then
Address = Cells(i, 15) 'Sends the email to the email address in a certain row and column 15)
strbody = "Relief Valve number " & Cells(i, 1) & " at " & Cells(i, 2) & y & Cells(i, 3) & Cells(i, 4) & " needs to be tested" 'Concatenates the sentence with the relief valve number, location, compressor, and or subsystem'
Set OutApp = CreateObject("Outlook.Application") 'Opens outlook'
Set OutMail = OutApp.CreateItem(0) 'Create new message'
In the ElseIf part I would like to add an and where both parts of the ElseIf statement have to be true. The part after the and would be if the value in ("P" & i) = ChrW(&H25A1)
Im just not quite sure how to add this in to the code.
It would be something like
ElseIf Range("L" & i) <= (Date - 365 * (3 * Range("N" & i))) - 182 AND ("P" & i) = ChrW(&H25A1)
Then ....but I'm not quite sure if that is correct
If x - Cells(3, 4) > 30 Then
Dim i As Long
i = 7
'code to see if a relief valve has to be retested'
Do While Range("A" & i) <> IsBlank
If Range("L" & i) = "" Then 'If the cell is blank an email is not sent'
ElseIf Range("L" & i) <= (Date - 365 * (3 * Range("N" & i))) - 182 Then
Address = Cells(i, 15) 'Sends the email to the email address in a certain row and column 15)
strbody = "Relief Valve number " & Cells(i, 1) & " at " & Cells(i, 2) & y & Cells(i, 3) & Cells(i, 4) & " needs to be tested" 'Concatenates the sentence with the relief valve number, location, compressor, and or subsystem'
Set OutApp = CreateObject("Outlook.Application") 'Opens outlook'
Set OutMail = OutApp.CreateItem(0) 'Create new message'
In the ElseIf part I would like to add an and where both parts of the ElseIf statement have to be true. The part after the and would be if the value in ("P" & i) = ChrW(&H25A1)
Im just not quite sure how to add this in to the code.
It would be something like
ElseIf Range("L" & i) <= (Date - 365 * (3 * Range("N" & i))) - 182 AND ("P" & i) = ChrW(&H25A1)
Then ....but I'm not quite sure if that is correct