+ Reply to Thread
Results 1 to 12 of 12

Audible and pop up notification on cell color change

  1. #1
    Registered User
    Join Date
    07-01-2010
    Location
    Sacramento, CA
    MS-Off Ver
    O365
    Posts
    70

    Audible and pop up notification on cell color change

    Title sums it up pretty well. I have a file where one cell changes to red on error and I am hoping to have it generate a popup and sound when that happens. Not great with VBA but I found some sites where I created a "beepnow" script and a macro but I was only able to get it working on a formula and not a color change. Attached is a sample file, it is pretty simple. C10-19 are the source or original numbers, D10-19 is where you would validate against the C numbers. My team specifically uses this for serial numbers where we are validating from a list and we scan into the D columns. I am hoping I can get an error message to popup anytime D6 turns red to warn the person they scanned the wrong thing. The sample has some of the C columns populated and you will see that D13 does not match against any of the numbers in the C columns so you get a no-match and D6 changes to red.

    If there is already some information here in the forum for this feel free to redirect me, I was unable to find much on the subject and most of it is older.

    I am currently running O365.

    Thanks!!!

    PS - If anyone wants bragging rights, I would love it in the media validation columns B and E displayed nothing if the cells they relate to are blank. In the example file D14-D19 have no data but E14-E19 say no match until there is one.
    Attached Files Attached Files
    Last edited by AliGW; 04-26-2023 at 10:59 AM. Reason: SOLVED tag applied - no need to edit the thread title!

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Audible and pop up notification on cell color change

    Here is an option for you:

    In the sheet code, try this code:

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rw&
    Application.ScreenUpdating False
    Application
    .EnableEvents False
    If Target.Cells.Count 1 Then Exit Sub
    If Not Intersect(TargetRange("D:D")) Is Nothing Then
        On Error Resume Next
        rw 
    Me.Columns(3).Find(Target, , xlValuesxlWhole).Row
        
    If rw 0 Then BeepMsgBox "No match found"
        
    On Error GoTo 0
    End 
    If
    Application.EnableEvents True
    Application
    .ScreenUpdating True
    End Sub 
    To turn the B and E fields to blank,
    in cell B10, update the formula to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and in cell E10, update the formula to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    Re: Audible and pop up notification on cell color change

    You can't detect a color change, but since your color change is cause by conditional formatting, you can detect the condition you are using for CF.

    This uses the Calculate event for the worksheet.
    Please Login or Register  to view this content.
    Bragging rights also claimed.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Audible and pop up notification on cell color change

    Quote Originally Posted by 6StringJazzer View Post
    You can't detect a color change, but since your color change is cause by conditional formatting, you can detect the condition you are using for CF.
    I beg to differ with this statement...

    Please Login or Register  to view this content.

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

    Re: Audible and pop up notification on cell color change

    Quote Originally Posted by Croweater View Post
    I beg to differ with this statement...
    I should be more specific. There is no event for a formatting change. You have successfully solved this by detecting the CF color assigned, but this code does not detect a color change. Any time there is any change in column D, it detects if the color is currently red.

    Good solution.

  6. #6
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Audible and pop up notification on cell color change

    Quote Originally Posted by 6StringJazzer View Post
    You have successfully solved this by detecting the CF color assigned, but this code does not detect a color change. Any time there is any change in column D, it detects if the color is currently red.
    This is true, but while we are being pedantic, the solution you offered doesn't do anything logically different. It detects a difference in two cells. It will beep not necessarily on a colour 'change', but if a condition exists that causes that colour....exactly the same as mine.

    The only difference is mine detects the colour, yours detects the condition that causes the colour.

    Advantage of my solution... if another condition existed that caused the colour change, mine would still work.
    Disadvantage...If you change the CF colour yours would still work.

    Another difference, with your solution, anything that causes a re-calculation, whether it is related or not to the condition we want to bring the alert to, will cause the alert. This might be a distraction (PITA). Up to the OP from here.
    Last edited by Croweater; 04-19-2023 at 12:47 AM.

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

    Re: Audible and pop up notification on cell color change

    I am not trying to debate which solution is better. In fact I thought your solution was very good and I gave you rep for it. I was clarifying my original point, which is just a matter of fact and not pedantic.

    People often want code to run if all they do is manually change the color of a cell, and there is no event for that. When dealing with conditional formatting the situation is a bit different.

  8. #8
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Audible and pop up notification on cell color change

    I'm not debating which is better either. Just trying to explain the differences/merits in both for the OP.

    Thanks for the rep!

  9. #9
    Registered User
    Join Date
    07-01-2010
    Location
    Sacramento, CA
    MS-Off Ver
    O365
    Posts
    70

    Re: Audible and pop up notification on cell color change

    Holy cow all, I COMPLETELY forgot I had posted this. How very lame of me!!! Been super busy at work and just got sidetracked. I will check these solutions out ASAP and get back to everyone.

  10. #10
    Registered User
    Join Date
    07-01-2010
    Location
    Sacramento, CA
    MS-Off Ver
    O365
    Posts
    70

    Re: Audible and pop up notification on cell color change

    I used the more simple code supplied by 6StringJazzer though both worked equally well. Bragging rights go to maniac though, his formula correctly identified a no match condition in the validation column (e) where 6Strings formula just stayed blank but still provided the audible notification and popup. I too was only able to get it to stay blank, very happy to have a working solution.

    Updated to solved and repped all 3 of you for usable solutions!!!

    Thank you so very much and I apologize again for not monitoring the thread.
    Last edited by AliGW; 04-26-2023 at 11:00 AM. Reason: Please do NOT quote unnecessarily!

  11. #11
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,926

    Re: Audible and pop up notification on cell color change

    To mark a thread as solved in future, please use the solved tag rather than editing the thread title. I have amended this for you today.
    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.

  12. #12
    Registered User
    Join Date
    07-01-2010
    Location
    Sacramento, CA
    MS-Off Ver
    O365
    Posts
    70

    Re: Audible and pop up notification on cell color change

    Oops, sorry about that and thank you for the edit. Appreciate it.

+ 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. [SOLVED] Color changing: change the color of one cell, and have other cells change colors too
    By hadydea in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2019, 04:51 PM
  2. Notification of a Cell Change
    By EdWoods in forum Excel General
    Replies: 2
    Last Post: 07-25-2017, 01:31 AM
  3. Change cell format (cell color+font color) based on color of another cell
    By Dedaluss in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2017, 03:27 AM
  4. Macro to change cell text color based on darkness of cell fill color
    By cincyshirm61 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2014, 12:11 PM
  5. Format cell color on change, how to change the color in other columns as well?
    By s80NL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2007, 09:24 PM
  6. [SOLVED] Linking a range in a class to a cell, with change notification
    By Luca in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-11-2005, 05:06 AM
  7. [SOLVED] notification by email by cell format change
    By notify me in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-08-2005, 04:06 AM

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