![]() |
Validation Object error
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? |
Validation Object error
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? |
Validation Object error
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? |
Validation Object error
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? |
Validation Object error
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? |
Validation Object error
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? |
Validation Object error
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? |
Validation Object error
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? |
All times are GMT +1. The time now is 01:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com