[attach]22980[/attach]
將錯誤的 - I am 18years old and weight50 Kgs.
更正為 - I am 18 years old and weight 50 Kgs.
如何能寫成一個 Pattern, 目前我是寫成兩個 "(\d)([a-zA-Z])" 和 "([a-zA-Z])(\d)", 做兩次循環。
請老師幫忙。作者: ikboy 時間: 2015-12-28 10:17
自己解決了, 分享一下:
Sub zz()
Dim arr, rx As Object, c$
Set rx = CreateObject("vbscript.regexp")
arr = ActiveSheet.UsedRange
With rx
.Pattern = "((d|[A-z])|([A-z]|d))(\d)"
.Global = True
For i = 1 To UBound(arr)
arr(i, 1) = .Replace(arr(i, 1), "$1 $2")
Next
End With
ActiveSheet.UsedRange = arr
End Sub作者: stillfish00 時間: 2015-12-28 10:58