效果展示:
自定义宏:
- 打开VBA , ALT + f11
- 插入模块,如下图
- 复制代码,并保存(ctrl + s)
VBA代码:
Function getnumber(cel As Range)
Dim reg As Object
Set reg = CreateObject("VBScript.RegExp")
With reg
.Pattern = "[^\d.-]+"
.Global = True
Dim sum As Double
sum = 0
arr
效果展示:
自定义宏:
VBA代码:
Function getnumber(cel As Range)
Dim reg As Object
Set reg = CreateObject("VBScript.RegExp")
With reg
.Pattern = "[^\d.-]+"
.Global = True
Dim sum As Double
sum = 0
arr