ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to check whether Cell has Validation? (https://www.excelbanter.com/excel-programming/380555-how-check-whether-cell-has-validation.html)

Joe HM

How to check whether Cell has Validation?
 
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


Bob Phillips

How to check whether Cell has Validation?
 
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)


"Joe HM" wrote in message
ps.com...
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




Joe HM

How to check whether Cell has Validation?
 
Ish ... is that the only way? Oh well ... I guess it works ... thanks!

Joe

On Jan 4, 1:34 pm, "Bob Phillips" wrote:
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)

"Joe HM" wrote in glegroups.com...



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- Hide quoted text -- Show quoted text -




All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com