+ Reply to Thread
Results 1 to 9 of 9

Alert prompt if date and time is reached

  1. #1
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Alert prompt if date and time is reached

    So in a sheet called Sims, I want to be prompted automatically if the date in cell D2 and the time in E2 have both passed. If they have passed I ideally would like an email to be automatically sent to an address saying this. My outlook will always be open for this. Ideally the subject would be whatever is contained in cell A2 and 'needs looking at'. So if cell A2 said Tigers, and the date and time were both in the past then an email would be sent with the subject 'Tigers needs looking at'.

    There will also be dates and times all the way down to row 20 and the same will need to happen for those. So the macro would check which rows meet the criteria and then send an email each time the criteria are met.

  2. #2
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: Alert prompt if date and time is reached

    Please Login or Register  to view this content.
    Hi ScabbyDog,
    is this okie for you?
    Last edited by wenqq3; 07-12-2013 at 05:13 AM.
    -If the problem is solved, please mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved".

    -Always upload a workbook before start your question
    To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

    +++ If my answer(s) helped you, please add me reputation by click on * +++

  3. #3
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Alert prompt if date and time is reached

    Hi. Yes this is very close. In the subject of the email, it will be Ai and not always A2. So if row E meets the criteria the email subject would be whatever is in cell E2 and 'needs looking at'.

    Also, would it be possible to put a check in place that makes sure outlook is open,and if it is not, open it for the user automatically? And the last thing would be that if the email was sent for say row 2, then in cell F2, it would enter the word SENT. And then when the macro is run again, if the criteria are met but the word SENT is in the row then the email will not send for that row.
    Last edited by ScabbyDog; 07-12-2013 at 06:46 AM.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Alert prompt if date and time is reached

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    I think the code opens up a new instance of outlook anyway. It shouldn't matter if outlook is open or not.

    add
    Please Login or Register  to view this content.
    and put an if statement along the lines of:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Alert prompt if date and time is reached

    since it's two different macros though, won't I need something like Sub emailHim(ByVal x as Integer) so the macro that actually sends the email knows which cell to use when populating the subject line?

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Alert prompt if date and time is reached

    Sorry I missed it was two separate macros. Probably need this:
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Alert prompt if date and time is reached

    Thanks for that. Works how I want now. I just tried running the macro with outlook closed though and it ran without error but did not send the email as outlook was closed and it didn't open outlook for me. Ideally I want it to Open outlook if it isn't already and then send it.

  8. #8
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Alert prompt if date and time is reached

    How would I finally alter the code so that if I have another sheet within the workbook open, it knows to look at the sheet with the correct data on and run it based on that. The sheet with the correct data is called Data1. When I added the above to the workbook I need it on, it doesn't run when I have other sheets open. However, if I have the sheet open and run it, it obviously runs fine.

  9. #9
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Alert prompt if date and time is reached

    One way:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1