Warning box if range value > 0

MPBJR

Board Regular
Joined
Mar 28, 2007
Messages
143
I need a message box to pop up if the value of one of the cells on a sheet is greater than 0. The range is B3 to B7. Now I have 5 different sheets in this work book, so lets say on sheet 1 the value of the range is gretaer than 0, I need a pop up box that says "check sheet 1". And if on sheet 2, same affected range is greater tham 0, then a pop up box that says "check sheet 2". (These sheets are updated based on values from a different workbook)

Here is a sample code I was trying to work with, placed in the "ThisWorkbook" location. (I think that's the correct place to put this??:confused:)


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Sheets("SH 5").Select
If (Range("B3:B7").Value > 0) Then
    MsgBox "Check sheet 5"
End If
End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("SH 5").Range("B3:B7").Value > 0) Then   MsgBox "Check sheet 5"
End Sub

I think that could work
 
Upvote 0
I can't get it to work, if I post it in a macro to run, I get an error.
I changed the range to only B5 where I know the value is "1", and it worked.
So I'm assuming it's having trouble adding the range B3:B7....
Not sure if there should be an extra step in there to add the range???

Thanks
 
Upvote 0
I must be mad, i'm sure there is a better way of doing this

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

On Error Resume Next

If Sheets("SH 5").Range("B3:B7").Value > 0 Then   MsgBox "Check sheet 5"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,411
Messages
6,119,346
Members
448,888
Latest member
Arle8907

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