+ Reply to Thread
Results 1 to 4 of 4

Run Macro when a Specific Cell value changes Automatically in Excel

  1. #1
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    86

    Run Macro when a Specific Cell value changes Automatically in Excel

    Hi!

    I need to run macros when specific values in specific cells are automatically updated in excel. The values are updated through data update or through calculations in excel.

    As a test case, following macro is expected to give a Message box when cell value is equal to 1 OR 2 OR A in cell A1. Macro is entered in the Excel Sheet.

    The Macro runs properly when 1 or 2 or A is manually entered in cell A1. However, in case the values in cell A1 are results from some calculations, the message box does not appear.

    Please Login or Register  to view this content.
    How to modify the above code to also handle values updated through calculations OR is there any other more efficient code that I could use. (Please note that I am not looking for a SheetChange event, but only a specific value appearing in a specific cell of a specific sheet).

    Note: Sample file attached with timer macro to show that the message box does not appear if values in cell A1 are automatically updated.

    Thanks.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Run Macro when a Specific Cell value changes Automatically in Excel

    The Worksheet_Changee event ignores changes initiated by calculation. To capture the calculation event, you would need something like:

    Please Login or Register  to view this content.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    86

    Re: Run Macro when a Specific Cell value changes Automatically in Excel

    Quote Originally Posted by JLGWhiz View Post
    The Worksheet_Changee event ignores changes initiated by calculation. To capture the calculation event, you would need something like:
    Thanks.
    Works great!!

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Run Macro when a Specific Cell value changes Automatically in Excel

    You're welcome,
    Regards, JLG

+ 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. VBA to automatically change specific cell value to active cell in specific range
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2016, 04:53 PM
  2. [SOLVED] Outlook Macro applies a specific rule to specific folder(s) automatically
    By mkn95u0 in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2015, 03:41 PM
  3. [SOLVED] Possible to read a specific cell from many excel files automatically?
    By RiP2 in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 03-30-2014, 10:18 PM
  4. [SOLVED] Macro to automatically save an Excel with a specific name depending on cell value
    By Stefan1979 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-17-2013, 11:51 AM
  5. Macro to copy specific line from text file and paste into specific cell in excel
    By keeneye in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 10:35 AM
  6. Replies: 5
    Last Post: 05-01-2012, 04:02 PM
  7. Automatically send an email from excel with specific data on specific date.
    By Angela1607 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2009, 08:11 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