|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
在最后几行添加两次dropdown动作就可以了实现时时查询了
- Private Sub TextBox1_Change()
- Dim arr(), mystr As String
- k = 0
- ReDim arr(0)
- For i = 2 To [m65536].End(xlUp).Row
- If Cells(i, "m") Like UCase(TextBox1.Value) & "*" Then
- ReDim Preserve arr(k)
- arr(k) = Cells(i, "L")
- k = k + 1
- End If
- Next
- ComboBox1.Clear
- mystr = Join(arr, "")
- If mystr = "" Then
- ComboBox1.AddItem mystr
- Else
- ComboBox1.List = arr
- End If
- ComboBox1.SetFocus
- ComboBox1.DropDown
- TextBox1.SetFocus
- ComboBox1.DropDown
- End Sub
复制代码 |
|