1
我想在VB用戶窗體中製作通配符搜索類型組合框。 搜索目標位於excel列。過濾器(數組(範圍))不適用於普及User_Form組合框
我可以運行:
Sub Combobox1_Populate(Optional fltr As String)
ComboBox1.List = Filter(Array(Range("A1:A9")), fltr)**
End Sub
:運行時錯誤 '13'
類型不匹配
Private Sub Combobox1_Populate(Optional fltr As String)
ComboBox1.List = Filter(Array("a", "ab", "abc", "abcd"), fltr)
End Sub
,但使用時失敗
爲什麼Filter(Array(Range
無法正常工作?請幫助糾正它。
它下面也沒有問題。只是Array(Range
當過濾器
Private Sub ComboBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Call Combobox1_Populate(ComboBox1.Text)
End Sub
Private Sub UserForm_Initialize()
Call Combobox1_Populate
End Sub
'Range'總是返回一個二維數組和'Filter'只接受1D之一。使用'Application.Transpose'轉置範圍。 – Rory
是這樣做的! – Jimmy
感謝羅裏,我不知道,並總是與字典上的過濾器:/;) –