+ Reply to Thread
Results 1 to 13 of 13

Call Macro when cell value changes to specific value

  1. #1
    Registered User
    Join Date
    03-05-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    19

    Question Call Macro when cell value changes to specific value

    Hey Reader,

    I got stuck in my project

    I have create a sheet where i have 15 row that have to be filled in with grade's. In the last collum there is formula that send's back the higest grade of that specfic row. What i want is that when the value of that formula = 3 run macro.
    atm i use this:

    Please Login or Register  to view this content.
    After filling in the form it will bring back the user to the sheet where he was working in. The user will now go on filling next row but than i face a problem. cus he will again have to fill in the form because the vba code registers again a "3" in range "AG2".

    what i basically want is that vba only call's the macro when a specific cell change to a value of "3".
    Attached Files Attached Files
    Last edited by Lyncz92; 08-29-2019 at 04:18 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,447

    Re: Call Macro when cell value changes to specific value

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules, they are not many

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,447

    Re: Call Macro when cell value changes to specific value

    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version. Your profile says Win10...

  4. #4
    Registered User
    Join Date
    03-05-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    19

    Re: Call Macro when cell value changes to specific value

    Alright got it thanks for changing it. i will keep it in mind for next threads

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Call Macro when cell value changes to specific value

    Please Login or Register  to view this content.
    You've written value of "3", so I assume 3 as number.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  6. #6
    Registered User
    Join Date
    03-05-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    19

    Re: Call Macro when cell value changes to specific value

    Hey KOKOSEK,

    thanks for your quick response. A moderator did change the thread with Code tag and informed me about the rules. i will keep this in mind for next thread.

    The "3" stance indeed for a number

  7. #7
    Registered User
    Join Date
    03-05-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    19

    Re: Call Macro when cell value changes to specific value

    Hey KOKOSEK,

    I have tested your code but that didn't work for me. and i really can't find the reason why it won't work. i have uploaded the file so you can see how it looks maybe you can find out whats the problem.

  8. #8
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Call Macro when cell value changes to specific value

    Is not about AG2 is about range AG2:AG16 as I see (if I am not mistaken).
    Try then:


    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-05-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    19

    Re: Call Macro when cell value changes to specific value

    I have test this and it does the same as worksheet change action.

    it checks the value's in range AG2:AG16 after every change in whatever cell. so for example:

    if i change the value in AG2 to 3 and enter the macro will run which is okay.
    after filling in form i want to go on and i fill in AG3 to a value of 2 and enter the macro will start running again and sees the 3 in AG2. this cause again he will open form which i dont want because it was already filled in for range AG2.

    maybe this is impossible?

  10. #10
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Call Macro when cell value changes to specific value

    Lets check then if we are checking latest row:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-05-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    19

    Re: Call Macro when cell value changes to specific value

    Thanks mate this did it .

  12. #12
    Registered User
    Join Date
    03-05-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    19

    Re: Call Macro when cell value changes to specific value

    Got 1 more issue which you maybe know how to fix.

    i need Error Handling on this sheet for when you fill in a incorrect size. because when i now fill in a incorrect size now on D2 the value in AG2 will be ### which will result in a error in the VBA code.

    i used a IsError formula but that won't work??

    Please Login or Register  to view this content.

  13. #13
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Call Macro when cell value changes to specific value

    Try:

    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] Call Macro when cell value changes to specific value
    By Lyncz92 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-16-2019, 01:45 PM
  2. Replies: 2
    Last Post: 08-13-2014, 06:39 PM
  3. Replies: 1
    Last Post: 08-13-2014, 05:46 PM
  4. For EACH cell in specific range meeting specific criteria, call a sub
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-02-2014, 03:00 PM
  5. How to call a sheet-specific macro
    By 4am in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-23-2013, 01:52 PM
  6. [SOLVED] Call a specific macro by selecting different cells
    By ska87RA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2013, 09:14 AM
  7. Call macro if specific text is within listbox
    By EthanM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2011, 12:00 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