How to check whether Cell has Validation?

J

Joe HM

Hello -

I am trying to do a very simple thing: I would like to know whether a
certain cell has a List Validation (i.e. dropdown) turned on.

I get the lSheet.Range().Validation but how does this tell me whether
there is a dropdown validation? I cannot check eny of the fields
without getting an error if there is none defined?

I tried lSheet.Range().Validation.Type = xlValidateList but that does
not work if there is no validation.

Any ideas?

Thanks,
Joe
 
B

Bob Phillips

On Error Resume Next
dv = ActiveCell.Validation.Formula1
On Error GoTo 0
MsgBox Not IsEmpty(dv)


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 

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

Top