msgbox when cell has value higher than 750

CV899000

Board Regular
Joined
Feb 11, 2016
Messages
98
Hi,

I am trying to prompt a message box if value entered into a cell exceeds 750.

I can do that with this code:

Set Target = Me.Range("B12")

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value > 750 Then
MsgBox "Large number, please consider"
End If
End Sub

Now, the problem is that I have a macro button in this sheet, that resets values in "B9", which then should reset the value of "B12" to "Input data".
But when I hit the reset button, the message box prompts several times before the value of "B12" changes from the high number to "input data", how can I fix that?
I do not want the message shown when I reset the cells.
 
If Target.Address = Range("B12").Address and Application.WorksheetFunction.IsNumber(target) Then
If Target.Value > 750 And num < 750 Then
num = Target
If MsgBox("Large number, run reset?", vbYesNo + vbQuestion) = vbYes Then
'you can call reset also here
'Call Reset
End If
Exit Sub
End If
If Target.Value < 750 Then
num = 0
End If
End If

like that?
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,215,453
Messages
6,124,930
Members
449,195
Latest member
Stevenciu

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