Results 1 to 9 of 9

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

Threaded View

  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:

    Private Sub Worksheet_Calculate()
    
    If Range("L3").Value < 0 Then _
    MsgBox "Negative Stock Alert!" & vbLf &
    " - Order more stock"
    End Sub
    - 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.

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