|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
- Dim i&, Arr, dm$
- Dim Language As Boolean
- Dim myStr As String, d
- Set d = CreateObject("Scripting.Dictionary")
- On Error Resume Next
- With Me.TextBox1
- If .Text = "" Then [b:b].ClearContents: 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
- With Sheet2
- Arr = Sheet1.[a1].CurrentRegion
- Arr = Sheet1.[a1].Resize(UBound(Arr), 13)
- .[b:b].ClearContents
- If myStr = "" Then Exit Sub
- If Language <> True Then
- For i = 2 To UBound(Arr)
- dm = Arr(i, 13)
- If InStr(dm, myStr) > 0 Then
- d(Arr(i, 3)) = ""
- End If
- Next
- Else
- For i = 2 To UBound(Arr)
- If InStr(Arr(i, 3), myStr) > 0 Then
- d(Arr(i, 3)) = ""
- End If
- Next
- End If
- .[b3].Resize(d.Count, 1) = Application.Transpose(d.keys)
- End With
- End Sub
复制代码 |
|