+ Reply to Thread
Results 1 to 5 of 5

VBA Message box display when cell value is changed, with a condition

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    161

    VBA Message box display when cell value is changed, with a condition

    Hi all,

    I'm struggling with a code for some time now. I need, when a cell value in a range is changed, a message box to popup asking if i really want to change the cell value. When clicking yes in the message box, the value will be changed. When clicking no, the code undo the previous step, and the original message comes back. The message will not affect if empty cells value was not changed.

    I need to adjust the code so the message box appears if i change value in a cell which is not empty.
    If i insert value in empty cell, it should not do nothing.

    It Will be good, but not essential to my request, if the message displays both the old and the new value, asking which one i wish to keep.

    I hope I've explain it clearly.

    Thank you in advance for the help.

    Cheers
    Igor


    Please Login or Register  to view this content.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Message box display when cell value is changed, with a condition

    Please Login or Register  to view this content.
    You do NOT need to check the intersect twice
    Last edited by Keebellah; 05-03-2017 at 04:30 AM. Reason: typo
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Message box display when cell value is changed, with a condition

    The problem is that that you do not know what the previous value was to start with so the pop-up will always appear
    the code works, minor changes made
    Please Login or Register  to view this content.
    You would need to know what the code was before you started.

  4. #4
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    161

    Re: VBA Message box display when cell value is changed, with a condition

    Keebellah, i see your point. It seems that i need to leave the pop-up. I've also tried to undo the last action, copy the value, and redo to the last entered value, hoping that with this i will get both of the original and new value. But I've entered in infinite loop and my excel crashed.

    Still, thank you for your help.

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Message box display when cell value is changed, with a condition

    The problem is that you have to take into account the EnableEvents state.
    Add this line of code to only allow one cell at a time as first line

    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)

Similar Threads

  1. [SOLVED] VB Code to instantly display message box if condition is met
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-04-2016, 09:50 PM
  2. display difference when cell value has changed in any given cell.
    By tshobe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-01-2015, 08:04 PM
  3. Replies: 4
    Last Post: 12-09-2014, 06:03 PM
  4. [SOLVED] Message box if cell selected or changed
    By darkblueblood in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-10-2014, 02:15 AM
  5. validation message if cell value in a row is blank depending on condition
    By svibuk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-23-2013, 01:18 AM
  6. Display an error message based on particular condition
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-30-2009, 05:53 AM
  7. Display message based on condition
    By Pat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-07-2005, 07:06 PM

Tags for this Thread

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