View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Test if cell.validation is set

'-----------------------------------------------------------------
Public Function HasValidation(r As Range) As Boolean
'-----------------------------------------------------------------
Dim i
Dim ma As Range
On Error Resume Next
HasValidation = True
i = r.Validation.Type
If Err.Number < 0 Then
HasValidation = False
Exit Function
End If
Set ma = r.MergeArea
If ma.Cells(1, 1).Address < r.Address Then
HasValidation = False
End If
End Function

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Filips Benoit" wrote in message
...
Dear All,

This codeline triggers an error if no validation is set (any value)

If ActiveCell.Validation.Type = xlValidateList Then

How can I first test if validation is set ?

If 'ActiveCell.valudation is set ' then
If ActiveCell.Validation.Type = xlValidateList Then
..................code........................
end if
end if

Thanks,

Filips