作者:乔山办公网日期:
返回目录:office365
如果是Excel2016、Excel365或Excel2019,试试看快速填充(快捷键:ctrl+e)。也就是在第一行每一个单元格手动写入你提取出来的内容,然后按ctrl+e来快速填充。
用正则表达式复自定义公式
Function 去除制(rng As Range, Optional shuzi As Integer = 2)
Set regx = CreateObject("vbscript.regexp")
With regx
.Global = True
If shuzi = 0 Then
.Pattern = "\d" '参数百2=0时去除数字
ElseIf shuzi = 1 Then
.Pattern = "[a-zA-Z]" '参数2=1去除字母
ElseIf shuzi = 2 Then
.Pattern = "[一-龢]" '参数2=2去除汉字
End If
去除 = .Replace(rng, "") '将匹配的度字符替换成空(删除)
End With
End Function
(代码来源:问51自学网-Excel2010 VBA教程-曾志贤老答师)