|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub VBA()
- Dim i
- Dim strTxt As String, strMsg As String, strKey$
- Dim objRegEx As Object, objMatch As Object, c As Range
- Dim j As Integer
- arr = [a1].CurrentRegion
- Set objRegEx = CreateObject("vbscript.regexp")
- objRegEx.Pattern = "-[A-Za-z]+ [A-Za-z]+"
- objRegEx.Global = True
- objRegEx.MultiLine = True
-
- For i = 2 To UBound(arr)
- strTxt = arr(i, 1)
- Set objMatch = objRegEx.Execute(strTxt)
- For Each st In objMatch
- arr(i, 1) = Replace(st, "-", "")
- Next st
- Next
- [f1].Resize(UBound(arr), 1) = arr
- Set objMatch = Nothing
- Set objRegEx = Nothing
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|