Send email - Non Worksheet Change event

sachavez

Active Member
Joined
May 22, 2009
Messages
469
I have a workbook with a summary sheet showing status of various worksheets (complete or not complete). Each worksheet is updated by a different user. In the summary sheet, I have a formula that says “Completed” when all of the worksheets have been completed.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Basic Summary set-up is:
<o:p></o:p>
A1: Workbook Status B1: formula to show Completed or “” (blank)
A5: Sheet1: Completed
A6: Sheet2: Not Complete
A7: Sheet3: Not Complete
Same concept for next 20 sheets….
<o:p></o:p>
The formula in B1 of the Summary sheet does not result in a Worksheet Change since everything is formula driven.
<o:p></o:p>
I found and modified the following code on the Internet (source unknown). The code works well when a Worksheet Change actually occurs; however, since there is no Worksheet Change, the code does not work.

Rich (BB code):
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OLook As Object 'Outlook.Application
Dim Mitem As Object 'Outlook.Mailitem
Dim SendAnEmail As Boolean
'If the target cell's value is not = to "Ready" then exit sub
If Range("Test") <> "Completed" Then Exit Sub
If Range("Test") = "Completed" Then SendAnEmail = True
'If the SendAnEmail variable is true then this code sends an email
'from Outlook. Change the properties to suit your needs.
If SendAnEmail Then
Set OLook = CreateObject("Outlook.Application")
Set Mitem = OLook.CreateItem(0)
Mitem.to = "xyz@xyz.com"
Mitem.Subject = "Spreadsheet XYZ is ready"
Mitem.Body = "Spreadsheet XYZ is ready for you"
Mitem.Send
End If
'Destroy any object references
Set OLook = Nothing
Set Mitem = Nothing
End Sub

<o:p></o:p>
I have searched the Internet for a solution, but have not yet found one. Can anyone help with a workaround that will trigger the email send event?
<o:p></o:p>
Thanks!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
How about having a worksheet_change routine on each of the worksheets that runs this macro, that way whenever somebody changes something on their sheet it will check to see whether the whole book is completed but not do anything until the last sheet is done? I'm sure there's a more elegant solution but this sounds like it would work to me?
 
Upvote 0
How about having a worksheet_change routine on each of the worksheets that runs this macro, that way whenever somebody changes something on their sheet it will check to see whether the whole book is completed but not do anything until the last sheet is done? I'm sure there's a more elegant solution but this sounds like it would work to me?


Stuart, let me look at that and advise.

Thanks for your input.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top