Results 1 to 18 of 18

Message box macro not working

Threaded View

  1. #15
    Registered User
    Join Date
    06-02-2010
    Location
    Grand Rapids, Michigan
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: Message box macro not working

    It seems that there really is to much code in the workbook.'I put all of the codes in the worksheet_Change in code for worksheet and they all seemed to work. I ended up going with this code for now.
    Private Sub Worksheet_Change(ByVal Target As Range)
    
     If Application.Intersect(Target, Union(Range("H104"), Range("L104"), Range("P104"), Range("T104"), Range("X104"))) Is Nothing Then Exit Sub
           If Range("H104").Value < Range("F104").Value - 0.02 Or Range("H104").Value > Range("F104").Value + 0.02 Then
           MsgBox "SCALE Check 1 HAS FAILED CALIBRATION AND MUST BE RECALIBRATED BEFORE IT CAN BE USED TO TAKE WEIGHTS"
           End If
           If Range("L104").Value < Range("J104").Value - 0.02 Or Range("L104").Value > Range("J104").Value + 0.02 Then
           MsgBox "SCALE Check 2 HAS FAILED CALIBRATION AND MUST BE RECALIBRATED BEFORE IT CAN BE USED TO TAKE WEIGHTS"
           End If
           If Range("P104").Value < Range("N104").Value - 0.02 Or Range("P104").Value > Range("N104").Value + 0.02 Then
           MsgBox "SCALE Check 3 HAS FAILED CALIBRATION AND MUST BE RECALIBRATED BEFORE IT CAN BE USED TO TAKE WEIGHTS"
           End If
           If Range("T104").Value < Range("R104").Value - 0.02 Or Range("T104").Value > Range("R104").Value + 0.02 Then
           MsgBox "SCALE Check 4 HAS FAILED CALIBRATION AND MUST BE RECALIBRATED BEFORE IT CAN BE USED TO TAKE WEIGHTS"
           End If
           If Range("X104").Value < Range("V104").Value - 0.02 Or Range("X104").Value > Range("V104").Value + 0.02 Then
           MsgBox "SCALE Check 5 HAS FAILED CALIBRATION AND MUST BE RECALIBRATED BEFORE IT CAN BE USED TO TAKE WEIGHTS"
           End If
               
    End Sub
    I'm still not really sure why its not working in the workbook as I removed all the exit subs and did not get the procedure to large worning but it still would not work when I copied and pasted it there. One thing i've learned there are alot of different ways to write code to get the same end result. And alot of it seems to be personal prefrence. Thanks to everyone for there assistance. You have all been very helpful.
    Last edited by scottwhittaker2333; 06-12-2010 at 06:29 PM.

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