macro - pop up if value entered is higher than expected

GVR40

New Member
Joined
Jul 5, 2010
Messages
12
Hi Team,

I need some help with a Macro. it is probably something simple for you guys, however my programming isn't up to scratch at this stage.

What I need is if a value is entered in a particular cell that is over say $100 then a pop up comes up that says "are you sure".

I need this for the range of cells D10:J35

Cheers for your help
Craig
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
  • Right-click on the sheet tab
  • Select View Code from the pop up menu
  • Paste the code below in the VBA edit window

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Range("D10:J35"), Target) Is Nothing Then
        If Target(1).Value > 100 And IsNumeric(Target(1)) Then
            MsgBox "Are you sure?", , "Input Greater Than $100"
        End If
    End If
End Sub
 
Upvote 0
Right click on the tab and select "View code"

Paste this in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not IsNumeric(Target.Text) Or Target.Rows.Count > 1 Then End
If Target.Column > 3 And Target.Column < 11 And Target.Row > 9 And Target.Row < 36 And Target.Value > 100 Then
    If MsgBox("Are you sure", vbYesNo, "Large value detected") = vbNo Then
        Target.Formula = ""
    End If
End If
End Sub

Cheers

Dan
 
Upvote 0
Data Validation will do this in 2003 as well...is that what you are saying ?

It can be done with using custom and in the formula use
Code:
=D10<100
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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