|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
- Dim i As Integer
- Dim Language As Boolean
- Dim myStr As String, aa As String
- Me.ListBox1.Clear
- With Me.TextBox1
- If .Value = "" Then Exit Sub
- For i = 1 To Len(.Value)
- If Asc(Mid$(.Value, i, 1)) > 255 Or Asc(Mid$(.Value, i, 1)) < 0 Then
- Language = True
- myStr = myStr & Mid$(.Value, i, 1)
- Else
- myStr = myStr & LCase(Mid$(.Value, i, 1))
- End If
- Next
- End With
- If KeyCode = 13 Then
- ActiveCell = TextBox1.Value: ActiveCell.Offset(1, 0).Activate
- TextBox1.Value = ""
- Exit Sub
- End If
- With Sheet3
- For i = 2 To .Range("c65536").End(xlUp).Row
- aa = .Cells(i, 3).Value & "|" & .Cells(i, 4).Value & "|" & .Cells(i, 5).Value & "|" & .Cells(i, 6).Value
- If Language = True Then
- If InStr(.Cells(i, 3).Value, myStr) Then
- Me.ListBox1.AddItem aa
- End If
- Else
- If InStr(.Cells(i, 9).Value, myStr) Then
- Me.ListBox1.AddItem aa
- End If
- End If
- Next
- End With
- End Sub
复制代码
在文本框中输入,按回车键可直接输入。 |
|