|
- Private Sub ListBox1_Click()
- ActiveCell = ListBox1.Text
- TextBox1.Visible = False
- ListBox1.Visible = False
- End Sub
- Private Sub TextBox1_Change()
- Dim s, arr, brr
- s = TextBox1.Text
- ListBox1.Clear
- arr = Sheets("编号").[a1].CurrentRegion
- For i = 1 To UBound(arr)
- If InStr(arr(i, 1), s) > 0 Then
- ListBox1.AddItem arr(i, 1)
- End If
- Next
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- If Target.Rows.Count > 1 Then Exit Sub
- If Target.Column <> 1 Then
- TextBox1.Visible = False
- ListBox1.Visible = False
- Exit Sub
- Else
- With TextBox1
- .Text = ""
- .Visible = True
- .Top = ActiveCell.Top
- .Left = ActiveCell.Left
- .Height = ActiveCell.Height
- .Width = ActiveCell.Width
- .Activate
- End With
- With ListBox1
- .Visible = True
- .Top = ActiveCell.Offset(0, 1).Top
- .Left = ActiveCell.Offset(0, 1).Left
- End With
- End If
- End Sub
复制代码 |
|