+ Reply to Thread
Results 1 to 13 of 13

Cell value change to 0 doesn't cause the event to occur

  1. #1
    Registered User
    Join Date
    04-28-2009
    Location
    Amherst, NY
    MS-Off Ver
    Excel 2013
    Posts
    11

    Cell value change to 0 doesn't cause the event to occur

    Hello,

    I've been searching the forum to get some clues but wasn't successful.

    I'm trying to run a bit of code that will trigger an inputbox when the value of a certain cell is changed to "0". The inputbox entry will be placed in a different cell. Been trying this:

    Please Login or Register  to view this content.
    Nothing occurs when the cell "C5" changes to "0". I feel as if I'm missing something simple here and I'd appreciate any guidance.

    TIA
    cherkey

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Cell value change to 0 doesn't cause the event to occur

    Hi,

    That is not a valid event declaration. If you only need to monitor one sheet, you should put the code into the worksheet code module and it should look like this
    Please Login or Register  to view this content.
    That will work as long as the cell change is not the result of a calculation.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Cell value change to 0 doesn't cause the event to occur

    Like xlnitwit says the belongs in the worksheet module, right click the sheet tab and select view code, paste the code there.


    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-28-2009
    Location
    Amherst, NY
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Cell value change to 0 doesn't cause the event to occur

    Hello,

    Thanks for the replies. Yes, there is a calculation that causes the C5 cell to become "0". That would be a Worksheet_calculate then?

    Also, when I run this code, the macro run window pops up, but I have no macro to run...I just need to code to execute... so I assume I'm still missing something... (?)

    cherkey

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Cell value change to 0 doesn't cause the event to occur

    The first line in my previous post explains where to put the code, it is a worksheet change event so if the sheet changes the code activates.

    Worksheet change event does not work if it is just a formula that changes.

    Check out another thread for more information

    https://www.excelforum.com/tips-and-...et-events.html

  6. #6
    Registered User
    Join Date
    04-28-2009
    Location
    Amherst, NY
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Cell value change to 0 doesn't cause the event to occur

    Thank you for your assistance, and the spreadsheet example. I was on the right track but I must have set something wacky in the file. I copied over to a new file and 'started over'. All is working now as I would have expected.

    Regards,
    cherkey

  7. #7
    Registered User
    Join Date
    04-28-2009
    Location
    Amherst, NY
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Cell value change to 0 doesn't cause the event to occur

    However, I spoke to soon :-\

    Yes, this occurs on a calculation so I do have this code working:

    Please Login or Register  to view this content.
    (The Select statement is used so I can cancel out of the loop that occurs, as I test this)

    But what happens now, is that it now always sees "C5" is being "0" so it just keeps looping the Inputbox. How can I get this only to react to the first time is becomes "0"?

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Cell value change to 0 doesn't cause the event to occur

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  9. #9
    Registered User
    Join Date
    04-28-2009
    Location
    Amherst, NY
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Cell value change to 0 doesn't cause the event to occur

    Hello,

    I've attached the file... a use description is within (pretty basic).

    Thank you for your time.

    cherkey
    Attached Files Attached Files

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Cell value change to 0 doesn't cause the event to occur

    Use a change event and check if C4 or E7 have changed.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  11. #11
    Registered User
    Join Date
    04-28-2009
    Location
    Amherst, NY
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Cell value change to 0 doesn't cause the event to occur

    Hello,

    Thank you. I tried and this doesn't work. As I understand it, a change event will not work because there's a formula that changes the cell contents.

    cherkey

  12. #12
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Cell value change to 0 doesn't cause the event to occur

    Norie's assumption is correct, if you are changing the values in C4 or E4 then the worksheet change event will work.

    Will you be entering values in column E or just E4?

  13. #13
    Registered User
    Join Date
    04-28-2009
    Location
    Amherst, NY
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: Cell value change to 0 doesn't cause the event to occur

    Hello again,

    OK, I think I now understand what this is doing now and it seems to be behaving (except the Inputbox pops up twice but I'll deal with it). Yes, the table will grow along with column E so I just changed the first line to:

    Please Login or Register  to view this content.
    Thanks again,
    cherkey

+ 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. ListBox Change Event doesn't fire
    By Michiel93 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2015, 10:34 AM
  2. Regular dropdown Change event doesn't run macro
    By JewelHick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-30-2014, 05:38 PM
  3. Determining how many times an event occur
    By DrStrangelove in forum Excel General
    Replies: 2
    Last Post: 09-18-2009, 03:46 PM
  4. Worksheet change event doesn't work properly
    By ffandango in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-05-2009, 06:03 PM
  5. Change Event doesn't change until I return to the Target Cell
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-11-2007, 05:20 PM
  6. [SOLVED] When does the Workbook_Open event occur?
    By Conan Kelly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2006, 06:49 PM
  7. worksheet change event doesn't work
    By gig in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2005, 11: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