View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim May Jim May is offline
external usenet poster
 
Posts: 430
Default Test if cell.validation is set

Found this using Google:

One way:

Dim mycel As Range
Dim vald As Variant
Set mycel = Range("D2")
On Error Resume Next
vald = mycel.Validation.Type
On Error GoTo 0
If vald < Empty Then
MsgBox "yes the cell have validation"
Else
MsgBox "no no, the cell is general."
End If


Hope this helps
Rowan Drummond

HTH - Jim May

"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