excel j计算式中怎么写备注
发布网友
发布时间:2022-04-22 04:04
我来回答
共1个回答
热心网友
时间:2023-07-12 02:53
自定义函数可以么?
Function he(rng As Range, regStr As String)
Dim reg As Object
Set reg = CreateObject("vbscript.regexp")
With reg
.Pattern = regStr
.Global = True
he = Application.Evaluate(.Replace(rng, ""))
End With
End Function
右键工作表标签》查看代码》复制以上代码到弹出的窗口中》关闭窗口,回到excel中输入公式
=he(A2,"\[.+?\]")
或者用以下代码
Function he(rng As Range)
Dim reg As Object
Set reg = CreateObject("vbscript.regexp")
With reg
.Pattern = "\[.+?\]"
.Global = True
he = Application.Evaluate(.Replace(rng, ""))
End With
End Function
公式=he(A2)