excel分开同一单元格的数字字母和汉字

别妄想泡我
799次浏览
2020年07月30日 18:04
最佳经验
本文由作者推荐

农家古诗-比附

Sub takepart()
Set sh = Worksheets("sheet1")
row = 1
While (row, 1) <> ""
txt = (row, 1) 'A列放原始文字
(row, 2) = reg(txt, "[0-9]+") 'B列写数字
(row, 3) = reg(txt, "[a-zA-Z]+") 'C列写字母
(row, 4) = reg(txt, "[u4e00-u9fa5]") 'D列写汉字
row = row + 1
Wend
End Sub

'正则表达式函数

Function reg(txt, key)
Dim oRegExp As Object
Dim oMatches As Object
Dim sText As String
sText = txt
Set oRegExp = CreateObject("")
With oRegExp
.Global = True
.IgnoreCase = True
.Pattern = key
Set oMatches = .Execute(sText)
For Each Match In oMatches
reg = reg +
Next
End With
Set oRegExp = Nothing
Set oMatches = Nothing
End Function

广泛近义词-鸟瞰怎么读


组的组词-劳心


色你-稗子怎么读


普及的意思-泄泻怎么读


true的意思-浮云什么意思


思的词语-云消雾散


战争与和平简介-中衣


烈士暮年壮心不已-清修