+ Reply to Thread
Results 1 to 5 of 5

Make a macro run based on three types of criteria

  1. #1
    Registered User
    Join Date
    06-03-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    21

    Question Make a macro run based on three types of criteria

    Hello all,
    So I have two macros. I want the first one to run if the value in cell A5 is between 101-125 (including 101 and 125). I want the second macro to run if A5 is 0. But, if a number other than 0 or 101-125 is entered, I would like an error message to pop up. I have found I cannot use data validation because it prevents the usage of the number zero.

    I've been using the following code in the sheet code but it simply is not setup for the value range of 101-125 and I can't figure out how to get it to work:
    Please Login or Register  to view this content.
    -All advice is appreciated,
    Aarzu Maknojia

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,471

    Re: Make a macro run based on three types of criteria

    Hi there,

    Try this:

    Please Login or Register  to view this content.
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

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

    Re: Make a macro run based on three types of criteria

    Hi Aarzu Maknojia,

    Try this:


    Please Login or Register  to view this content.
    (or whatever the correct macro names are)
    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

  4. #4
    Registered User
    Join Date
    06-03-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Make a macro run based on three types of criteria

    Please Login or Register  to view this content.
    This code works perfectly. Now if there any way, when a number aside from 101-125 and 0 is entered to run Macro 3 as well as display the message box?

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,471

    Re: Make a macro run based on three types of criteria

    Now if there any way, when a number aside from 101-125 and 0 is entered to run Macro 3 as well as display the message box
    Yes, just call it after the message box statement, i.e.

    Please Login or Register  to view this content.
    Regards,

    Robert

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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