ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is Validation? (https://www.excelbanter.com/excel-programming/322023-validation.html)

Otto Moehrbach

Is Validation?
 
Excel 2002, WinXP
I have a number of cells in a range. Some of these cells have Data
Validation, some do not. I'm using a Worksheet_Change macro to pick up on
any changes within this range.
I need to find out if the changed cell has Data Validation or not.
What is the code for that? Thanks for your help. Otto



Bob Phillips[_6_]

Is Validation?
 
Otto,

Here is a little function

Function HasValidation(rng As Range)
Dim iType As Long
If rng.Cells.Count 1 Then
HasValidation = "More than 1 cel"
Else
On Error Resume Next
iType = rng.Validation.Type
On Error GoTo 0
HasValidation = iType < 0
End If
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a number of cells in a range. Some of these cells have Data
Validation, some do not. I'm using a Worksheet_Change macro to pick up on
any changes within this range.
I need to find out if the changed cell has Data Validation or not.
What is the code for that? Thanks for your help. Otto





Otto Moehrbach

Is Validation?
 
Thanks Bob. That works out well for me. Otto
"Bob Phillips" wrote in message
...
Otto,

Here is a little function

Function HasValidation(rng As Range)
Dim iType As Long
If rng.Cells.Count 1 Then
HasValidation = "More than 1 cel"
Else
On Error Resume Next
iType = rng.Validation.Type
On Error GoTo 0
HasValidation = iType < 0
End If
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have a number of cells in a range. Some of these cells have Data
Validation, some do not. I'm using a Worksheet_Change macro to pick up
on
any changes within this range.
I need to find out if the changed cell has Data Validation or not.
What is the code for that? Thanks for your help. Otto








All times are GMT +1. The time now is 05:49 PM.

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