Programatically Check Dropdowns in Excel Sheet using VBA
The following code will help to check the presence of combo boxes on Excel sheet
Sub Check_DropDowns_Count()
If ActiveSheet.DropDowns.Count = 0 Then
MsgBox "No combo boxes"
End If
End Sub
Sub Check_DropDowns_Source()
Dim oDDwn As Object
If ActiveSheet.DropDowns.Count <> 0 Then
Set oDDwn = ActiveSheet.DropDowns(1)
If InStr(1, oDDwn.ListFillRange, "!") Then
MsgBox "Reference Another Sheet"
End If
End If
End Sub
The above code uses the Sheet - Range Separator to check if the Dropdown refers to current sheet or another sheet
No comments:
Post a Comment