Monday, June 30, 2008

Check Presence of Comboboxes in Excel Sheet using Excel VBA

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

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.