之前前輩範例引用參考之
1=去空白
2=去數字
3=取數字
4=去英文
5=取英文
6=取漢字
7=去漢字
Sub yy()
With CreateObject("VBSCRIPT.REGEXP")
.Global = True
For i = 1 To 7
.Pattern = Application.Choose(i, "\s", "[0-9]", "[^0-9]", "[A-Za-z]", "[^A-Za-z]", "[^\u4e00-\u9fa5]", "[\u4e00-\u9fa5]")
Cells(i, 2) = .Replace([a1], "")
Next i
End With
End Sub作者: ashan0418 時間: 2014-12-5 10:49
Sub test()
str1 = "123abc321"
For i = 1 To Len(str1)
If Asc(Mid(str1, i, 1)) >= 97 And Asc(Mid(str1, i, 1)) <= 122 Then
str2 = str2 + Mid(str1, i, 1)
End If
Next
MsgBox str2
End Sub作者: t8899 時間: 2014-12-5 10:50