Message box macro not working

SCOTTWHITTAKER2333

New Member
Joined
Jun 1, 2010
Messages
32
I have a macro for a new wt. form that I want to display a message if a range is below a negative value of another cell. But I can't seem to get it to work. I think the problem is in the part that I highlighted in red below. This is what I have:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

'
' hold box Macro
' Macro recorded 5/28/2010 by SCOTT.WHITTAKER
'
'
If (Range("F50:Y68").Value < 0 - Range("H14")) Then
MsgBox "Product has failed Individual Weights, All product must be held from last acceptable check until next acceptable check. Please click the remove button for the affected Group to remove the affected check from the final average."

End If
End Sub
 
Try something like this in the module for the worksheet you want to monitor:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Cell As Range
    If Application.Intersect(Target, Union(Range("A8:A106"), Range("C8:C106"))) Is Nothing Then Exit Sub
    For Each Cell In Range("F50:Y68")
        If Cell.Value < Range("H14").Value Then
            MsgBox "Product has failed Individual Weights, All product must be held from last acceptable check until next acceptable check"
            Exit Sub
        End If
    Next Cell
End Sub
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top