+ Reply to Thread
Results 1 to 9 of 9

Failing to trigger a message box when cell value in a range is less than 0

  1. #1
    Registered User
    Join Date
    03-29-2020
    Location
    Nottingham, England
    MS-Off Ver
    2013
    Posts
    6

    Failing to trigger a message box when cell value in a range is less than 0

    Hi folks,

    I'm trying to make a message box pop up with a warning message/instruction when my stock level goes into negative stock, and it has been suggested VBA is the way forward.

    I have had success using:

    Please Login or Register  to view this content.
    - where L3 is a cell containing a formula to display the stock level.

    This works but only for the corresponding cell (L3), if i change it to L5 or L127 etc, it only triggers the message box for "errors" that cell, i.e. if the value is <0.

    I attempted to change the cell to a cell range ("L3:L269") as you would normally write it in an Excel formula, but then I get an error window with "Run-time error '13':
    Type mismatch"


    I've attached my workbook, the column/cell range I'm trying to apply this to is column "L" (Stock Remaining) in the Jobs tab.
    I'm very new to this and am a bit confused by all this new language, any advice will be gratefully received.
    Attached Files Attached Files
    Last edited by BillyGoat123; 03-30-2020 at 10:10 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Failing to trigger a message box when cell value in a range is less than 0

    Consider using Conditional Formatting to highlight a cell (or Row) in say RED when the value is <0. You wouldn't need any code.
    Last edited by AlphaFrog; 03-29-2020 at 09:21 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

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

    Re: Failing to trigger a message box when cell value in a range is less than 0

    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 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. Thanks

  4. #4
    Registered User
    Join Date
    03-29-2020
    Location
    Nottingham, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Failing to trigger a message box when cell value in a range is less than 0

    I have the conditional format set up, I'd just like to be able to trigger the message box as well. It's for a system that other people will be using so I need some prompts including really

  5. #5
    Registered User
    Join Date
    03-29-2020
    Location
    Nottingham, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Failing to trigger a message box when cell value in a range is less than 0

    Thank you, my bad

  6. #6
    Registered User
    Join Date
    03-29-2020
    Location
    Nottingham, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Failing to trigger a message box when cell value in a range is less than 0

    I have the conditional format set up, I'd just like to be able to trigger the message box as well. It's for a system that other people will be using so I need some prompts including really

  7. #7
    Registered User
    Join Date
    03-29-2020
    Location
    Nottingham, England
    MS-Off Ver
    2013
    Posts
    6

    Re: Failing to trigger a message box when cell value in a range is less than 0

    ok, this seemed to solve it:

    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Failing to trigger a message box when cell value in a range is less than 0

    This might be more efficient....

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-30-2005
    Location
    Penzance Cornwall, UK
    MS-Off Ver
    Office 365
    Posts
    198

    Re: Failing to trigger a message box when cell value in a range is less than 0

    I have been looking at this thread as I do with a lot of threads to try and learn a bit more.

    My question is nothing to do with the problem as such, but something I would like clarifying.

    When cell L3 is selected, Excel’s Name Box initially displays L3 then changes to L31269, WHY?

+ 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] Pressing F3 key to trigger message box
    By noname91 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2020, 04:06 PM
  2. [SOLVED] macro to trigger Cond Formatting when just CLICK on any cell in a range
    By MannStewart in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2020, 03:30 AM
  3. Debug message / trigger and stop macro.
    By CH81 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2019, 09:05 PM
  4. Trigger message box after user updates VBA form based on data calculated in a cell
    By blackelvis73 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2016, 12:51 PM
  5. 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
  6. Message box VBA - trigger to remain constant, need VBA to stop thereafter
    By orlando212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2013, 08:55 AM
  7. Replies: 3
    Last Post: 11-15-2010, 01:53 AM

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