Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wish to create a formula via code that will do the following
As a Custom Data Validation in cell A1, if the value entered in A1 is less than the value in A5, then return an error message etc, however if the value in A5 is negative, then the value entered by user in A1 should be at least 0% BTW value in A1 & A5 will be percent Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like below placed in the Sheet Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("A1").Value < "" And Range("A5").Value < "" And Range("A5").Value 0 And Range("A1").Value <= Range("A5").Value Then MsgBox "The Value you entered into Cell A5 MUST be Greater than(or Equal to) the Value in A5 !", vbCritical Range("A1").Value = "" Range("A1").Activate Else If Range("A1").Value < "" And Range("A5").Value < "" And Range("A5").Value < 0 And Range("A1").Value < 0 Then MsgBox "A5 is a Negative Number and Therefore A1 MUST be a Positive Number !", vbCritical Range("A1").Value = "" Range("A1").Activate End If End If End Sub ?? Corey.... "Sean" wrote in message oups.com... I wish to create a formula via code that will do the following As a Custom Data Validation in cell A1, if the value entered in A1 is less than the value in A5, then return an error message etc, however if the value in A5 is negative, then the value entered by user in A1 should be at least 0% BTW value in A1 & A5 will be percent Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set the validation to Custom and the formula is:
=(A1MAX(A5,0)) -- Gary''s Student - gsnu200718 "Sean" wrote: I wish to create a formula via code that will do the following As a Custom Data Validation in cell A1, if the value entered in A1 is less than the value in A5, then return an error message etc, however if the value in A5 is negative, then the value entered by user in A1 should be at least 0% BTW value in A1 & A5 will be percent Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
custom data validation on cells with data validation values | Excel Worksheet Functions | |||
Data Validation, Custom | Excel Worksheet Functions | |||
Data Validation, Custom | Excel Worksheet Functions | |||
Data Validation, Custom | Excel Worksheet Functions | |||
Custom Data Validation | Excel Discussion (Misc queries) |