So I want to launch a userform if a person has selected a cell that has listbox associated with it how can I detect it?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Check if Target cell has listbox?
End Sub
So I want to launch a userform if a person has selected a cell that has listbox associated with it how can I detect it?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Check if Target cell has listbox?
End Sub
you could use this function:
Function HasValidation(rng As Range) As Boolean
Dim validationType As Long
validationType = -1
On Error Resume Next
validationType = rng.Validation.Type
HasValidation = validationType >= 0
End Function
and exploit it in your event handler:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If HasValidation(Target) Then
... your code
End If
End Sub