|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Dim Arr, Arr2, oReg As Object, oMatchCollection As Object
- Application.ScreenUpdating = False
- Set oReg = CreateObject("VBSCRIPT.REGEXP")
- oReg.Pattern = "^(.*?)([\u4e00-\u9fff\uf900-\ufa2d]{1,10})\s*(\d{2,3})$"
- Arr = [a3].Resize([a1].CurrentRegion.Rows.Count - 2)
- ReDim Arr2(1 To UBound(Arr), 1 To 3)
- For i = 1 To UBound(Arr)
- Set oMatchCollection = oReg.Execute(Arr(i, 1))
- If oMatchCollection.Count > 0 Then
- Arr2(i, 1) = oMatchCollection(0).submatches(0)
- Arr2(i, 2) = oMatchCollection(0).submatches(1)
- Arr2(i, 3) = oMatchCollection(0).submatches(2)
- End If
- Next
- [b3].Resize(UBound(Arr), 3) = Arr2
- Application.ScreenUpdating = True
复制代码 |
评分
-
1
查看全部评分
-
|