Validate if cell use data validation

P

Pascal.Landry

Hi there,

Does anyone know how I can validate if a cell is using datavalidation using.
I mean using VBA and not by opening the Data validation menu...

It seams that whenever there is no validation, the value of all parameters
are not set. I've tried to use isnull, isempty... nothing worked...

Thanks for your help !
 
B

Bob Umlas, Excel MVP

Function ActiveCellUsesDV(Rg As String)
ActiveCellUsesDV = Not
Application.Intersect(Cells.SpecialCells(xlCellTypeAllValidation), Range(Rg))
Is Nothing
End Function

Then you can use something like
If ActivecellUsesDV("H11") then...
etc.
HTH
 
P

Pascal.Landry

Thanks !

Bob Umlas said:
Function ActiveCellUsesDV(Rg As String)
ActiveCellUsesDV = Not
Application.Intersect(Cells.SpecialCells(xlCellTypeAllValidation), Range(Rg))
Is Nothing
End Function

Then you can use something like
If ActivecellUsesDV("H11") then...
etc.
HTH
 

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