Results 1 to 18 of 18

Message box macro not working

Threaded View

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

    Smile Message box macro not working

    I have the following code that I want to have a message box pop up if the value of cell H104 is more or less than the value of cell F104 by more than 0.02. I have been playing with this code for about 3 days now but can't seem to get it to work. Any Ideas?

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Dim Cell As Range
    If Application.Intersect(Target, Range("H104")) Is Nothing Then Exit Sub
    For Each Cell In Range("H104")    
    If (Cell.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"
                 Exit Sub
            End If
         Next Cell
     If Application.Intersect(Target, Range("H104")) Is Nothing Then Exit Sub
      For Each Cell In Range("H104")  
     If (Cell.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"
                  Exit Sub
            End If
    Next Cell
    End Sub
    Last edited by scottwhittaker2333; 06-12-2010 at 07:08 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