Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to read the Formula1 property of a validation object of the cell Target.
Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like this:
Sub AABB() Dim s As String Set target = ActiveCell s = "" On Error Resume Next s = target.Validation.Formula1 On Error GoTo 0 If s < "" Then MsgBox s Else MsgBox "No validation" End If End Sub -- Regards, Tom Ogilvy "Peter Zinniker" wrote: I want to read the Formula1 property of a validation object of the cell Target. Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Uff, not very elegant coding.
Anyway thank you very much for the hint. Peter "Tom Ogilvy" wrote: Something like this: Sub AABB() Dim s As String Set target = ActiveCell s = "" On Error Resume Next s = target.Validation.Formula1 On Error GoTo 0 If s < "" Then MsgBox s Else MsgBox "No validation" End If End Sub -- Regards, Tom Ogilvy "Peter Zinniker" wrote: I want to read the Formula1 property of a validation object of the cell Target. Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If target.Validation.Value = True Then target.Validation.Formula1 End If "Peter Zinniker" wrote: I want to read the Formula1 property of a validation object of the cell Target. Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would disagree.
Let's see your elegant approach. -- regards, Tom Ogilvy "Peter Zinniker" wrote: Uff, not very elegant coding. Anyway thank you very much for the hint. Peter "Tom Ogilvy" wrote: Something like this: Sub AABB() Dim s As String Set target = ActiveCell s = "" On Error Resume Next s = target.Validation.Formula1 On Error GoTo 0 If s < "" Then MsgBox s Else MsgBox "No validation" End If End Sub -- Regards, Tom Ogilvy "Peter Zinniker" wrote: I want to read the Formula1 property of a validation object of the cell Target. Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That seems to return true for every cell (whether they have validation or
not) except cells that have validation and the value in the cell doesn't match the validation criteria. -- Regards, Tom Ogilvy "Joel" wrote: If target.Validation.Value = True Then target.Validation.Formula1 End If "Peter Zinniker" wrote: I want to read the Formula1 property of a validation object of the cell Target. Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Joel
Thank you for the answer but it does not solve my problem: The Value property is TRUE even if there is no validation rule defined. "Help" says: TRUE if all the validation criteria are met (that is, if the range contains valid data) Regards, Peter "Joel" wrote: If target.Validation.Value = True Then target.Validation.Formula1 End If "Peter Zinniker" wrote: I want to read the Formula1 property of a validation object of the cell Target. Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
None found so far.
I will (heavyheartedly) use your code. No offence! Have a nice day! Peter "Tom Ogilvy" wrote: I would disagree. Let's see your elegant approach. -- regards, Tom Ogilvy "Peter Zinniker" wrote: Uff, not very elegant coding. Anyway thank you very much for the hint. Peter "Tom Ogilvy" wrote: Something like this: Sub AABB() Dim s As String Set target = ActiveCell s = "" On Error Resume Next s = target.Validation.Formula1 On Error GoTo 0 If s < "" Then MsgBox s Else MsgBox "No validation" End If End Sub -- Regards, Tom Ogilvy "Peter Zinniker" wrote: I want to read the Formula1 property of a validation object of the cell Target. Target.Validation.Formula1 produces an "Application-defined or object-defined error" if Target don't have a validation rule. How cant I check whether a validation list is defined? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error '1004' application or object defined error | Excel Programming | |||
Run Time Error 1004: Application or Object Defined Error | Excel Programming | |||
Object Variable Not Set Error on Selection object | Excel Worksheet Functions | |||
Error 1004, Application-definded or object-defined error | Excel Programming | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming |