pop up box

G

Guest

I would like a box to pop up saying NEW RECORD.

In column F if the cell is the minimun number then say NEW RECORD
For example F1 has 200
F2 has 199
F3 has 144 so now If I put 140 in F4 a box appears
sayin new record
but if I put 150 in cell A4 then nothing
is this possible?
Thanks
 
G

Guest

Put this in sheets code module

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
x = Target: Target = ""
If x < Application.WorksheetFunction.Min(Range("F:F")) Then MsgBox ("NEW
RECORD")
Target = x
Application.EnableEvents = True
End Sub


"delete automatically" skrev:
 
G

Guest

When I copied and paste the formula the If x <
Application.WorksheetFunction.Min(Range("F:F")) Then MsgBox ("NEW RECORD")
was red. Then when I tried it gave me a compile error and Private Sub
Worksheet_Change(ByVal Target As Range) was highlited yellow.
Any ideas?
 
G

Gord Dibben

You have been hit by wordwrap in the posting that's why the red text appears

Try this revision pasted with the line continuation mark "_" added.


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
x = Target: Target = ""
If x < Application.WorksheetFunction.Min(Range("F:F")) _
Then MsgBox ("NEW Record ")
Target = x
Application.EnableEvents = True
End Sub

BTW...........it is not a formula, it is event code.


Gord Dibben MS Excel MVP
 
G

Guest

I ges it's the usual formatting problems in here try:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
x = Target: Target = ""
If x < Application.WorksheetFunction.Min(Range("F:F")) _
Then MsgBox ("NEW RECORD")
Target = x
Application.EnableEvents = True
End Sub


"delete automatically" skrev:
 
G

Guest

Thank you, that worked perfectly

excelent said:
I ges it's the usual formatting problems in here try:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
x = Target: Target = ""
If x < Application.WorksheetFunction.Min(Range("F:F")) _
Then MsgBox ("NEW RECORD")
Target = x
Application.EnableEvents = True
End Sub


"delete automatically" skrev:
 
T

T. Valko

This can be done using data validation.

Suppose the range of interest is F1:F10
Select the range F1:F10
Goto Data>Validation
Allow: Custom
Formula: =F1<>MIN(F$1:F$10)
Click the Error Alert tab
Check: Show error alert......
Style: Information
Type in a message like: New Record
OK out
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top