Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default mutiple Validations for cells

--------------------------------------------------------------------------------

I have an excel spread sheet, Col I is a Date, Col K is a Date, Col P is a
date and Col T is a text(with list validation)
I have validation that if if T = "As is" and P < I or K (which ever one has
a value) then Error.
..Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="=IF(T2= ""Accept as
is"",(IF(P2=(IF(K2<"""",K2,I2)),TRUE, FALSE)), TRUE)"

But if the user changes T to some other value then it is ok to change P, But
they could put any value in that field. I Need to validate that P is a DATE
also
I was trying to do a validation Greater than 01/01/2007 but I can not do
multiple validations on the same cell.
How can I validate P is a date also
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default mutiple Validations for cells


VB has an ISDate() function available in the language. Can you not use that
somehow; either in a test before your .Add Type:= statement or create a
Function like
Function IsADate(anyDate As Range)
IsADate = False
If IsDate(anyDate.Value) Then
IsADate = True
End If
End Function

and call it with a
IsADate(Worksheets("sheetname").Range("P2"))
type of statement

So, it takes on the form of
=IF(IsADate(Worksheets("sheetname").Range("P2"))," true action here","false
action here")
in VB. You could use it on a worksheet as simply =IsADate(P2)

Hope this helps some.

"ljhopkins_LOST and Cant find My Way" wrote:

--------------------------------------------------------------------------------

I have an excel spread sheet, Col I is a Date, Col K is a Date, Col P is a
date and Col T is a text(with list validation)
I have validation that if if T = "As is" and P < I or K (which ever one has
a value) then Error.
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="=IF(T2= ""Accept as
is"",(IF(P2=(IF(K2<"""",K2,I2)),TRUE, FALSE)), TRUE)"

But if the user changes T to some other value then it is ok to change P, But
they could put any value in that field. I Need to validate that P is a DATE
also
I was trying to do a validation Greater than 01/01/2007 but I can not do
multiple validations on the same cell.
How can I validate P is a date also

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default mutiple Validations for cells

excel(vba) does not have a isdate function, (how strange)

"JLatham" wrote:


VB has an ISDate() function available in the language. Can you not use that
somehow; either in a test before your .Add Type:= statement or create a
Function like
Function IsADate(anyDate As Range)
IsADate = False
If IsDate(anyDate.Value) Then
IsADate = True
End If
End Function

and call it with a
IsADate(Worksheets("sheetname").Range("P2"))
type of statement

So, it takes on the form of
=IF(IsADate(Worksheets("sheetname").Range("P2"))," true action here","false
action here")
in VB. You could use it on a worksheet as simply =IsADate(P2)

Hope this helps some.

"ljhopkins_LOST and Cant find My Way" wrote:

--------------------------------------------------------------------------------

I have an excel spread sheet, Col I is a Date, Col K is a Date, Col P is a
date and Col T is a text(with list validation)
I have validation that if if T = "As is" and P < I or K (which ever one has
a value) then Error.
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="=IF(T2= ""Accept as
is"",(IF(P2=(IF(K2<"""",K2,I2)),TRUE, FALSE)), TRUE)"

But if the user changes T to some other value then it is ok to change P, But
they could put any value in that field. I Need to validate that P is a DATE
also
I was trying to do a validation Greater than 01/01/2007 but I can not do
multiple validations on the same cell.
How can I validate P is a date also

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default mutiple Validations for cells

It does for me.

You may want to look again.

ljhopkins_LOST and Cant find My Way wrote:

excel(vba) does not have a isdate function, (how strange)

"JLatham" wrote:


VB has an ISDate() function available in the language. Can you not use that
somehow; either in a test before your .Add Type:= statement or create a
Function like
Function IsADate(anyDate As Range)
IsADate = False
If IsDate(anyDate.Value) Then
IsADate = True
End If
End Function

and call it with a
IsADate(Worksheets("sheetname").Range("P2"))
type of statement

So, it takes on the form of
=IF(IsADate(Worksheets("sheetname").Range("P2"))," true action here","false
action here")
in VB. You could use it on a worksheet as simply =IsADate(P2)

Hope this helps some.

"ljhopkins_LOST and Cant find My Way" wrote:

--------------------------------------------------------------------------------

I have an excel spread sheet, Col I is a Date, Col K is a Date, Col P is a
date and Col T is a text(with list validation)
I have validation that if if T = "As is" and P < I or K (which ever one has
a value) then Error.
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="=IF(T2= ""Accept as
is"",(IF(P2=(IF(K2<"""",K2,I2)),TRUE, FALSE)), TRUE)"

But if the user changes T to some other value then it is ok to change P, But
they could put any value in that field. I Need to validate that P is a DATE
also
I was trying to do a validation Greater than 01/01/2007 but I can not do
multiple validations on the same cell.
How can I validate P is a date also


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default mutiple Validations for cells

I double checked - it is there as part of the basic VB engine - doesn't even
require the Analysis Pack add-in to be set up or anything. Try this code

Sub testIsDate()

Debug.Print IsDate("1/1/2007")

End Sub

Make sure the Immediate window is visible in the VB editor, click on the
line of code and hit [F5]. You should see TRUE show up in the Immediate
window. If you get a run-time error, then the only thing I can say is that
your copy of Excel is busticated.


"ljhopkins_LOST and Cant find My Way" wrote:

excel(vba) does not have a isdate function, (how strange)

"JLatham" wrote:


VB has an ISDate() function available in the language. Can you not use that
somehow; either in a test before your .Add Type:= statement or create a
Function like
Function IsADate(anyDate As Range)
IsADate = False
If IsDate(anyDate.Value) Then
IsADate = True
End If
End Function

and call it with a
IsADate(Worksheets("sheetname").Range("P2"))
type of statement

So, it takes on the form of
=IF(IsADate(Worksheets("sheetname").Range("P2"))," true action here","false
action here")
in VB. You could use it on a worksheet as simply =IsADate(P2)

Hope this helps some.

"ljhopkins_LOST and Cant find My Way" wrote:

--------------------------------------------------------------------------------

I have an excel spread sheet, Col I is a Date, Col K is a Date, Col P is a
date and Col T is a text(with list validation)
I have validation that if if T = "As is" and P < I or K (which ever one has
a value) then Error.
.Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="=IF(T2= ""Accept as
is"",(IF(P2=(IF(K2<"""",K2,I2)),TRUE, FALSE)), TRUE)"

But if the user changes T to some other value then it is ok to change P, But
they could put any value in that field. I Need to validate that P is a DATE
also
I was trying to do a validation Greater than 01/01/2007 but I can not do
multiple validations on the same cell.
How can I validate P is a date also



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Cells Mutiple Criteria kjguillermo Excel Discussion (Misc queries) 1 December 8th 06 03:41 PM
How do I fill mutiple cells with one pull down menu? garr1095 Excel Worksheet Functions 1 November 2nd 06 06:16 AM
Can I do two validations on a cell? [email protected] Excel Worksheet Functions 3 September 1st 06 01:16 PM
data validations Catfish25 Excel Discussion (Misc queries) 2 August 30th 06 06:43 PM
3 data validations Mohan Excel Worksheet Functions 2 June 7th 06 07:47 PM


All times are GMT +1. The time now is 04:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"