Is Validation?

  • Thread starter Thread starter Otto Moehrbach
  • Start date Start date
O

Otto Moehrbach

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,

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)
 
Thanks Bob. That works out well for me. Otto
Bob Phillips said:
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)
 

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

Back
Top