|
抄的一段代码,给你参考一下
显示窗体
sub show()
UserForm1.Show
End Sub
设置
Private Sub ComboBox1_Change()
On Error Resume Next
Dim xx()
Dim zz(0)
ww = ComboBox1.Value
yy = Application.CountIf(Columns(1), ww & "*")
If yy = 0 Then ComboBox1.List() = zz
ReDim xx(yy - 1)
k = -1
For i = 1 To Sheets("sheet1").[a65536].End(xlUp).Row
If Cells(i, 1).Value Like ww & "*" Then
k = k + 1
xx(k) = Cells(i, 1).Value
End If
Next i
ComboBox1.List = xx
ComboBox1.DropDown
End Sub |
|