|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub a()
Dim s$, i&, j&
Dim match As Object, matchs As Object
Dim reg As Object
Set reg = CreateObject("vbscript.regexp")
reg.Pattern = "企业账号:([a-zA-Z]+)" '正则表达式
reg.Global = True 'true是查找所有,false是只查找第一个
Dim arr
arr = [a1].CurrentRegion
For i = 2 To UBound(arr) '不含标题
s = arr(i, 8) '指定列
Set matchs = reg.Execute(s) '所有结果集合
For j = 1 To matchs.Count
For Each match In matchs
Cells(i, j).Offset(0, 8) = match
j = j + 1
Next
Next
Next
End Sub |
|