Hello All
I am hoping you can help me with the below.
What I want
I have an excel spreadsheet containing a list of tasks that need completing. I have coded the sheet with formula to automatically indicate when items require an update (example attached). What I am after is for an automatic email to be sent to me for each item listed as ‘Update Required’. The body needs to contain the brief description of the item, so for example the ‘Update Required’ indicator is in column F and the item description is in column B, so would require something like ‘ActiveCell.Offset(-4,0)’ to select and copy the description.
What I have
Below is my attempt at the code required but it isn’t working right. This is what I want:
• Email to only be sent for items listed as ‘Update Required’ in column F
• Email to still work even when the worksheet is not open
• Email body to contain the brief description contained in column B
Spreadsheet condition trigger
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rcell As Range
Dim i As Integer
Set Rcell = Range("F16:F18")
For Each Cell In Rcell
If Target.Cells.Value = "" Then Exit Sub
If Target.Cells.Value = "Update Required" Then
ActiveCell.Offset(-4, 0).Copy
Call Action_Required
End If
'End If
Next Cell
End Sub
Email process
Sub Action_Required()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim RngCopied As Range
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set RngCopied = Selection
strbody = "Check Daily Task sheet" & vbNewLine & vbNewLine & _
"as something needs a chase up"
On Error Resume Next
With OutMail
.To = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "Chase up is required"
.Body = strbody
.HTMLBody = RngCopied
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Appreciate this is a lot to ask but am grateful for any assistance I can receive
Many thanks All
G1
Bookmarks