【发布时间】:2017-06-05 00:44:18
【问题描述】:
我有一个可搜索的组合框,当我在其中输入字母时可以从中选择建议(下面的 vba)。但是,我希望能够单击组合框的箭头(当然,如果我没有在其中输入任何其他内容)并查看整个下拉列表。出于某种原因,如果我单击箭头,下面的代码不会显示整个列表。
非常感谢任何建议。
Dim ws As Worksheet
Dim x, dict
Dim i As Long
Dim str As String
Set ws = Sheets("Lists")
x = ws.Range("Listing").value
Set dict = CreateObject("Scripting.Dictionary")
str = Me.cbo1.value
If str <> "" Then
For i = 1 To UBound(x, 1)
If InStr(LCase(x(i, 1)), LCase(str)) > 0 Then
dict.Item(x(i, 1)) = ""
End If
Next i
Me.cbo1.List = dict.keys
Else
Me.cbo1.List = x
End If
Me.cbo1.DropDown
【问题讨论】: