ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Multiple Data Validation (https://www.excelbanter.com/excel-worksheet-functions/196721-multiple-data-validation.html)

VoxBox-Richard

Multiple Data Validation
 
Hello,
Is it possible to have multiple validation rules per cell? I would like it
if I could give a warning if the input was within a certain range of values,
and a stop message if it was between another.
Thank you.
Richard.

Bob Phillips[_3_]

Multiple Data Validation
 
Don't think so using DV, you could do it with VBA.

--
__________________________________
HTH

Bob

"VoxBox-Richard" wrote in message
...
Hello,
Is it possible to have multiple validation rules per cell? I would like
it
if I could give a warning if the input was within a certain range of
values,
and a stop message if it was between another.
Thank you.
Richard.




VoxBox-Richard

Multiple Data Validation
 
Can you any help me doing in using VB then? Or provide me a link explaining
how to do it.

Cheers.
R.


"Bob Phillips" wrote:

Don't think so using DV, you could do it with VBA.

--
__________________________________
HTH

Bob

"VoxBox-Richard" wrote in message
...
Hello,
Is it possible to have multiple validation rules per cell? I would like
it
if I could give a warning if the input was within a certain range of
values,
and a stop message if it was between another.
Thank you.
Richard.





Bob Phillips[_3_]

Multiple Data Validation
 
Something like this

Option Explicit

Private mmPrev As Variant

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target

'reject check
If .Value < 0 Or .Value 10 Then

MsgBox "Invalid value", vbOKOnly, "Input Error"
.Value = mmPrev
ElseIf .Value 5 Then

MsgBox "Value may be too high", vbOKOnly, "Input Warning"
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
mmPrev = Target.Value
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--
__________________________________
HTH

Bob

"VoxBox-Richard" wrote in message
...
Can you any help me doing in using VB then? Or provide me a link
explaining
how to do it.

Cheers.
R.


"Bob Phillips" wrote:

Don't think so using DV, you could do it with VBA.

--
__________________________________
HTH

Bob

"VoxBox-Richard" wrote in
message
...
Hello,
Is it possible to have multiple validation rules per cell? I would
like
it
if I could give a warning if the input was within a certain range of
values,
and a stop message if it was between another.
Thank you.
Richard.








All times are GMT +1. The time now is 09:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com