|
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
ActiveCell = ListBox1.List(i, 0)
TextBox1.Visible = False
ListBox1.Visible = False
TextBox1 = ""
ListBox1.Clear
Exit For
End If
Next i
End Sub
Private Sub TextBox1_Change()
Dim d As Object
zd = TextBox1.Text
Set d = CreateObject("scripting.dictionary")
With Sheets("参数")
r = .Cells(Rows.Count, 1).End(xlUp).Row
ar = .Range("a1:a" & r)
End With
For i = 2 To UBound(ar)
If InStr(ar(i, 1), zd) > 0 Then
d(ar(i, 1)) = ""
End If
Next i
With ListBox1
.Visible = True
.Top = ActiveCell.Top + 20
.Left = ActiveCell.Left + 10
.List = d.keys
End With
End Sub
Private Sub Worksheet_SelectionChange(ByVal T As Range)
If T.Row > 1 And T.Column = 3 Then
If T.Count > 1 Then End
With TextBox1
.Visible = True
.Top = T.Top
.Left = T.Left
.Activate
End With
Else
TextBox1.Visible = False
ListBox1.Visible = False
TextBox1 = ""
ListBox1.Clear
End If
End Sub
|
|