+ Reply to Thread
Results 1 to 6 of 6

Trigger macros based on cell value

  1. #1
    Registered User
    Join Date
    09-21-2017
    Location
    Salt Lake City
    MS-Off Ver
    MS2016
    Posts
    12

    Trigger macros based on cell value

    I have to trigger one of two macros depending on the value of a cell. Here is what I have so far.

    Please Login or Register  to view this content.
    no matter what the value is in A4, it triggers notify1.
    Last edited by drflgd; 10-30-2017 at 03:48 PM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,606

    Re: Trigger macros based on cell value

    Indeed strange.
    To answer properly:
    1) Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    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, it also maintains VBA formatting.

    Click on Edit to open your thread, 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

    2) Will you please attach a SMALL sample Excel workbook(s) ? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. (If trere are typical cases like: all unique values/duplicates could occur, day/night, nobody present/several persons at once, before/on/past due, etc. - please show them all or at least indicate in text) The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution(s) is/are also shown (mock up the results manually).

    3. Make sure that all confidential/restricted information (either personal or business) like real e-mails, social security numbers, bank accounts, etc. is removed first!!

    To attach an Excel file you have to do the following: Just before posting, scroll down and press Go Advanced button and then scroll down and press Manage Attachments link. Now follow the instructions at the top of that pop-up screen.

    3) MAy be your data is not number? Or may be it's just text which looks like a number?

    4) if there are just 2 options there is no need to use elseif. Else would be enough.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    09-21-2017
    Location
    Salt Lake City
    MS-Off Ver
    MS2016
    Posts
    12

    Re: Trigger macros based on cell value

    I tried your modification and it did the same thing.

    I tried a different way with the same results.

    Please Login or Register  to view this content.
    The logic you shared should work @Kaper. The above code should too. The Call to notify(1,2,3) is just variations of Ron de Bruin's Outlook code which can be found by googling his name (and excel outlook vba email). His code works fine when I trigger it manually. Just can figure out how to trigger it based on the greater/less then criteria. Is there another syntax that might work?

    I attached a graphic of my logic as a reference
    Attached Images Attached Images

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,606

    Re: Trigger macros based on cell value

    Thanks for editing the post according to our rules
    I still have doubts here:
    Quote Originally Posted by Kaper View Post
    3) MAy be your data is not number? Or may be it's just text which looks like a number?
    Which could be clarified if you:
    Quote Originally Posted by Kaper View Post
    2) Will you please attach a SMALL sample Excel workbook(s) ? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

  5. #5
    Registered User
    Join Date
    09-21-2017
    Location
    Salt Lake City
    MS-Off Ver
    MS2016
    Posts
    12

    Re: Trigger macros based on cell value

    I read what you said the first time... but it just didn't click! @Kaper, you are right. A2 was a percentage. All I needed to do was convert my field from a percentage and it worked (or change the code with a simple decimal).

    It's the simple things that stump me the most! Duh, that was simple.

    Thanks for the help

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,606

    Re: Trigger macros based on cell value

    So indeed, I feel like a prophet :-) keeping saying:
    Attach a sample workbook
    Would be lovely if you mark thread SOLVED (above your first post you can find Thread Tools to do so.

+ 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. Replies: 2
    Last Post: 06-06-2015, 11:33 AM
  2. Trigger Macro based on cell change in different sheet
    By rz9wqm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2015, 06:48 AM
  3. Macro to trigger an email from Excel (on a MAC) based on Cell Change
    By nishit021178 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-26-2015, 04:45 AM
  4. 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
  5. [SOLVED] How can we trigger a simple macro based on cell value of another cell automatically with
    By omega0010 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-16-2013, 05:02 PM
  6. Automatically send an email based on the value of a cell and/or trigger date
    By psn.arya in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2013, 06:17 PM
  7. Trigger a macro based on cell colour change
    By hermithead in forum Excel General
    Replies: 1
    Last Post: 02-23-2010, 09:57 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