kann mit jemand sagen, wie ich per VBA abprüfen kann, ob in einer Zelle eine Gültigkeitsprüfung (Validation, eigentlich der Dropdown ein Liste) mittels Menüpunkt "Daten | Gültigkeit..." hinterlegt ist.
Danke im Voraus
Gruss
Adi
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngValidation As Range
On Error GoTo ENDE
Set rngValidation = Cells.SpecialCells(xlCellTypeAllValidation)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, rngValidation) Is Nothing Then
If ActiveCell.Validation.InCellDropdown = True And _
ActiveCell.Validation.Type = 3 Then
Application.EnableEvents = False
'Statt der MsgBox hierhin schreiben, was dann passieren soll.
MsgBox "Dropdown!"
End If
End If
ENDE:
Application.EnableEvents = True
End Sub
Sub test()
Dim B As Boolean
On Error Resume Next
B = Range("B1").Validation.InCellDropdown
On Error GoTo 0
MsgBox IIf(B, "Vorhanden", "Nicht vorhanden")
End Sub
Sub test()
Dim x
On Error Resume Next
x = Selection.Validation.Type
On Error GoTo 0
If x = 0 Then MsgBox "keine Prüfung"
End Sub