|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
细微的调整就不做了,,,,,,大概就这样。具体格式要具体分析了。
Sub test()
Dim i As Long, Position As Integer, myString As String, English As String, Chinese As String
Dim Regex As Object, matches As Object
Set Regex = CreateObject("VBScript.RegExp")
Regex.Pattern = "[A-Za-z]"
For i = 1 To [A65536].End(xlUp).Row
myString = Cells(i, 1).Value
Position = InStrRev(myString, "@")
If Position > 0 Then
English = Left(myString, Position - 1)
Chinese = Right(myString, Len(myString) - Position)
Debug.Print Chinese
Else
Set matches = Regex.Execute(myString)
If matches.Count > 0 Then
Position = matches.Item(x).FirstIndex
English = Right(myString, Len(myString) - Position)
Chinese = Left(myString, Position)
Else
MsgBox "Unknown Format !!!"
End If
End If
Next
End Sub |
|