How can I use vba to tell if an Active X combobox on an excel sheet has a list with items in it.
The following returns an error if the combobox has nothing in it's list:
if UBound(MyComboBox.List, 1) > 1 then
and the following returns an error if there are items in the list:
if MyComboBox.List <> Null then
Cheers!
Oliver.
The following code with check if there are items in the ComboBox1 and list all the items it finds:
Dim lngRow As Long
If ComboBox1.ListCount > 0 Then
For lngRow = 0 To ComboBox1.LineCount - 1
Debug.Print ComboBox1.List(lngRow , 0)
Next intRow
End If
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.