|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Sub lll()
Dim rex As Object
Dim rng As Range
Dim i As Integer, k As Integer, m As Integer
Dim str
Set rex = CreateObject("VbScript.regexp")
i = Cells(Rows.Count, 1).End(xlUp).Row
Range("b:b").Clear
For Each rng In Range("a1:a" & i)
With rex
.Global = True
.IgnoreCase = True
.Pattern = "[0-9]+"
For k = 0 To .Execute(rng.Value).Count - 1
str = str & "-" & .Execute(rng.Value)(k)
Next
m = m + 1
Cells(m, 2) = Mid(str, 2, 99)
End With
str = ""
Next
End Sub
|
评分
-
1
查看全部评分
-
|