+ Reply to Thread
Results 1 to 8 of 8

Setting up an email alert when conditional formatting changes a cell

  1. #1
    Registered User
    Join Date
    08-16-2023
    Location
    London. England
    MS-Off Ver
    365
    Posts
    4

    Setting up an email alert when conditional formatting changes a cell

    Hi. Just joined this forum and grateful for a solution to the following:


    A1 contains the name of a license. B1 has the license?s date of expiry. C1 is ?today?s date?.
    By using conditional formatting?
    if the license expires greater than 60 days from today?s date, B1 is green
    if it expires between 1-60 days from today?s date, B1 is orange.
    if it has expired, B1 is red.

    Question: What do I need to do so that on the day B1 changes from green to orange, and subsequently from orange to red, an email is sent to an Outlook address which has in the subject line ?Check spreadsheet?

    Thank you.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,736

    Re: Setting up an email alert when conditional formatting changes a cell

    Welcome to the Forum CLRG!

    Does C1 have this formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ?

    There is no easy way to detect when conditional formatting changes, and at the root of it, what you really want is to determine when a date threshold is crossed.

    There is no formula that can do what you want. This requires VBA. We need two things:

    1. A method for triggering the VBA. You can do this manually, or you can have something to automatically check once a day. If you check once a day, you will need a cell someplace to record the last time it was checked so it knows if it should check again.

    2. A record of when an email was sent for each time threshold, for each license. This is to know an email has been sent so that duplicates are not sent.

    You will also need to be specific about what recipient, subject, and body you want in the email.

    To make this go faster, please attach a file with sample data, but not private data. See yellow banner at the top of the page.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-16-2023
    Location
    London. England
    MS-Off Ver
    365
    Posts
    4

    Re: Setting up an email alert when conditional formatting changes a cell

    Thanks for your comments.

    I've uploaded file and you can see that the conditional formatting in B5..B7 uses "NOW"....and not "today" in C1
    (that was from an earlier attempt, my mistake, sorry). There would be only one email recipient, the subject line would simply
    refer the recipient to the file, and there would be no need for anything in the body. In the past, I've cut and pasted
    solutions into VBA but nothing more than that so wouldn't know how to go about using it in this instance

    This is not a deal breaker but a nice to have because the user may not be regularly accessing the file and so an
    email reminder would be best practice.

    Thanks again

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,736

    Re: Setting up an email alert when conditional formatting changes a cell

    Quote Originally Posted by CLRG View Post
    I've uploaded file
    I don't see the file link. Sometimes this happens if the file is too big and the error message is not prominent. If your file is bigger than 1MB you will need to zip it; a zip file attachment can be up to 9.77MB. Please try again using one of these methods:

    To attach a file, use the Paper Clip icon and follow instructions, or use this method:

    1. Under the text box where you type your reply click the Go Advanced button.
    2. On the next screen scroll down and under the Attachments section click the Manage Attachments link, which will show a pop-up window.
    3. Click the Choose File button to select a file to attached.
    4. Click the Upload button to upload the file.
    5. Then click the Close This Window button. Your file is now attached to your post.

  5. #5
    Registered User
    Join Date
    08-16-2023
    Location
    London. England
    MS-Off Ver
    365
    Posts
    4

    Re: Setting up an email alert when conditional formatting changes a cell

    Thanks and I've done what you advised regarding the attachment. In the previous screen, it shows it's attached although
    I don't see it now and can't figure out why. So I'll make this the last attempt. Thanks anyway.
    Attached Files Attached Files

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,736

    Re: Setting up an email alert when conditional formatting changes a cell

    I have the file now.

    For your CF rules I suggest using TODAY(). The result is an integer that will be an exact match for today's date. But if you use NOW() it is greater than TODAY() and won't match today's date. If you care about days and not times, it is cleaner to use TODAY(). I recommend putting 60 in a cell and refer to that instead of hard-coding 60 into the rules. If you ever wanted to change it, that would make it easier.

    This sample file has just one set of dates, so I am providing a solution that will work for that.

    This version will check once a day for changes in status. It will check when the file is opened and each time it is recalculated, but it will only actually check the statuses the first time each day this happens.

    I have done only cursory testing so you should test this to make sure it does what you want. To test:

    Clear the date in B1 on the Parameters sheet
    Clear the Email dates in C6:D7 on the data sheet
    Select any date and either change it, or hit F2 then ENTER. This will force VBA to recognize a change.

    The code will run automatically as soon as you open the file, and again any time there is a change to the worksheet data.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-16-2023
    Location
    London. England
    MS-Off Ver
    365
    Posts
    4

    Re: Setting up an email alert when conditional formatting changes a cell

    SOLVED: Many thanks

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,421

    Re: Setting up an email alert when conditional formatting changes a cell

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Email Alert when cell triggers red (low stock)
    By R1_Canuck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2016, 08:06 AM
  2. Conditional formatting visual clue is not enough - need audible alert
    By witneygrain in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-25-2015, 02:30 PM
  3. Replies: 0
    Last Post: 10-10-2013, 05:14 AM
  4. Alert and filtering based on conditional formatting VBA
    By clapforthewolfman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2013, 12:41 PM
  5. Conditional Formatting Alert because of Due Date
    By ticjac in forum Excel General
    Replies: 7
    Last Post: 05-18-2013, 09:02 AM
  6. Conditional formatting to alert me when a delivery date is due
    By Rex81 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-10-2013, 10:28 PM
  7. Looking for Conditional Formatting formula to alert overlapping times
    By lzuke in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-17-2012, 01:08 PM

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