Validation Object error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
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.
 
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
 
None found so far.
I will (heavyheartedly) use your code.
No offence! Have a nice day!
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top