How do I check if a cell has a dropdown

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am validating a spreadsheet checking a range of cells and need to validate
that all the cells in the range has a dropdown associated with it. Any ideas
what the code is to do this.....
 
Sub test()
Dim nValType As Long
Dim rng As Range, cel As Range

Set rng = Selection

On Error Resume Next
For Each cel In rng
nValType = 0
nValType = cel.Validation.Type ' error if not validation

If nValType = 0 Then
' no validation
ElseIf nValType = xlValidateList Then
' dropdown list
Else
' some other validation
End If
Next

End Sub

Regards,
Peter T
 
Back
Top