Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if cell.validation is set
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validation Data using Validation Table cell range..... | Excel Discussion (Misc queries) | |||
VB syntax to test for data validation in a cell | Excel Discussion (Misc queries) | |||
Test in Validation Box Very Small Font Size... | Excel Discussion (Misc queries) | |||
Calculate mean of test scores from rows of test answers | Excel Discussion (Misc queries) | |||
How can i test a cell for bold style in a cell (Excel 2003)? | Excel Worksheet Functions |