Hi All,
I have attached a sample workbook for easy of explanation and help.The sample worksheet will always be as a pivot table.
If column E is not Yes I want an email sending out (I have tried Ron De Bruin method).
The tricky bit that I cannot work out is I need the email sending to the address in column F (which is the result of a vlookup & not part of the pivot table, although could be if needed).
I need the email to include the contents of Columns A,C,D with the relevant headers.
So what I mean is if E2 is not Yes then email [email protected],
The email should send the message " A Return To Work is needed for ", C2, " who was absent from work on ", A2, "and returned to work on " D2.
Hope that makes sense and someone can help.
Hi Sean,
there's no workbook attached.
I wrote something similar to this just the other day
Email Pivot Table Report to Various People
If you can supply your workbook I can adapt the code for you.
To clarify : for every row in the pivot table, you want an email sent? All at the same time? So the macro will be triggered by, for example, clicking a button on the sheet?
regards
Phil
Hi Philip,
Thanks for your reply.
In answer to your questions:-
For every row in the pivot that does not contain a Yes in column E I need an email sending. So if I use a slicer to filter out the column that does not contain Yes then it would leave all emails that need sending.
All emails to be sent at the same time so a button would work.
Hi Sean,
The attached workbook will send your emails. The sample data has lots of blanks and dates that are not set so these will need to be fixed for the code to run correctly.
As it is, there's a variable in the VBA called DisplayEmail that is set to True. This will display the email on your screen for you to check before you manually send it. I recommend that you do this whilst you are testing things.
Once you're happy everything is working, change DisplayEmail to false and the emails will be sent without you needing to each one by hand.
Regards
Phil
Hi Phil,
That seems to work brilliantly.
What I have forgot to add in on my original post was that column D also has to have a date in it otherwise an email is generated and potentially the person is not back at work yet.
I have noticed I missed this on the original post when I test ran the code you have done.
Thanks in advance.
Hi Sean,
Try this.
regards
Phil
Thanks a lot Phil for your help this has worked brilliantly.
no worries. 🙂