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
 
Top