Data Validation?

S

sot

I enter a Cost code into a cell and for all instances these cost codes are
allowed except for one. For this one exception, I want to allow the entry
but bring up a warning box to ask user to check the entry. Is this possible
in Data Validation or must I use some other way. I know I could just use and
IF, but I don't want to add another column to my worksheet.

Many thanks for any responses
 
B

Bob Phillips

If you have a custom type in Validation with a formula to say

=H1<>"my value"

and then on the error tab set the style to Warning, the message will come up
but the user can Continue.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
T

Toppers

I don't believe you can check using Data Validation but the code below would
allow a check. Insert this code into the worksheet where you want the check
to work.

Change $A$1 to the cell you require and 1234 to your "code".

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo endsub
If Application.And(Target = Range("$A$1"), Target.Value = 1234) Then
MsgBox "Warning - check this code " & Target.Value
End If
endsub:
Application.EnableEvents = True
End Sub

HTH
 
Top