+ Reply to Thread
Results 1 to 6 of 6

Trigger Macro when a cell value changes

  1. #1
    Registered User
    Join Date
    08-03-2009
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    19

    Trigger Macro when a cell value changes

    Hello again. It has been a while since I've been on. I haven't done any programming for a long time. I have a worksheet where I would like to trigger a macro that I've written when a cell value changes. The cell value is calculated using a formula so the event needs to be triggered by the value changing not hitting enter in the cell. I can trigger the event using the following

    Please Login or Register  to view this content.
    I would like to change it so that it only calls the macro Fill if the calculated value in Column N changes. The above is an uneducated programmers way of cheating the system so that it always triggers no matter which value I change. This makes it trigger when any number is changed though. I only want it to trigger when a number that effects the calculated value in Column N is changed.

    Thanks again for your help.

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

    Re: Trigger Macro when a cell value changes

    I wonder whether this might work:

    Please Login or Register  to view this content.
    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

  3. #3
    Registered User
    Join Date
    08-03-2009
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Trigger Macro when a cell value changes

    Thanks xladept. That doesn't work as that is what I started with. If I type a value in that range it works but as the value in that range is calculated by a formula it doesn't seem to work. EG. if I type a number in say C6 then the value in N6 will change but this doesn't trigger the call function if I use the code you have shown. Is there some other setting I may have turned off that I need to turn on.

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Trigger Macro when a cell value changes

    Try this worksheet event

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-03-2009
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Trigger Macro when a cell value changes

    Thanks kvsrinivasamurthy, I hadn't seen that function before. I did a little research on it and from what I can see it triggers if any calculation in the entire worksheet occurs. Is there a way to limit it to if a calculation occurs in a set range. Thanks again.

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Trigger Macro when a cell value changes

    Pl see attached file. It is an example.

    Selected range is B4:E6
    See the formulas in that range
    change in K3,K4 and L5 bring changes in the range B4:E6 and calls "Fill" macro
    "Fill" macro types a text in A1 in this example.

    H1 has formula
    change in H2 changes H1 value
    This does not call macro, because it is not in selected range.

    Code used for worksheet events

    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] Trigger macro on cell change
    By ejoneslor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2016, 06:05 PM
  2. Adjust a code from cell range trigger to button trigger
    By ld2x07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-01-2014, 10:02 AM
  3. Change of value in a cell don't trigger macro
    By tuf82 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-01-2011, 09:50 AM
  4. trigger a macro when changing a cell
    By marcospaterson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2008, 07:27 PM
  5. Trigger a macro when leaving a cell
    By jiminic in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-13-2007, 04:49 AM
  6. [SOLVED] Trigger Macro on change in cell value
    By qwerty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2006, 12:30 AM
  7. Replies: 9
    Last Post: 10-17-2005, 09:05 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