ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Validate if cell use data validation (https://www.excelbanter.com/excel-discussion-misc-queries/195835-validate-if-cell-use-data-validation.html)

Pascal.Landry

Validate if cell use data validation
 
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 !

Bob Umlas, Excel MVP

Validate if cell use data validation
 
Function ActiveCellUsesDV(Rg As String)
ActiveCellUsesDV = Not
Application.Intersect(Cells.SpecialCells(xlCellTyp eAllValidation), Range(Rg))
Is Nothing
End Function

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

"Pascal.Landry" wrote:

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 !


Pascal.Landry

Validate if cell use data validation
 
Thanks !

"Bob Umlas, Excel MVP" wrote:

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

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

"Pascal.Landry" wrote:

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 !



All times are GMT +1. The time now is 08:13 PM.

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