- Sub dwds()
- Set reg = CreateObject("vbscript.regexp")
- arr = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
- brr = Array("一", "二", "三", "四", "五", "六", "七", "八", "九")
- With reg
- .Global = True
- .Pattern = ".*?([\d一二三四五六七八九十壹贰叁肆伍陆柒捌玖拾]+)|.+"
- crr = [a1].CurrentRegion
- For x = 2 To UBound(crr)
- Cells(x, 2) = .Replace(crr(x, 1), "$1")
- Next
- End With
- For i = LBound(arr) To UBound(arr)
- [b:b].Replace brr(i), arr(i), lookat:=xlPart
- Next
- For x = 2 To UBound(crr)
- sr = Cells(x, 2)
- If Len(sr) = 2 Then
- Cells(x, 2) = Replace(sr, Right(sr, 1), "0" & Right(sr, 1))
- End If
- Next
- End Sub
复制代码
没想到啥好办法 |