做一个自定义函数NewEval(ref)
Const BF = "[", BE = "]"
Function NewEval(ref As Range)
Dim i!, j!, s$
s = ""
For i = 1 To Len(ref.Value)
If Mid(ref.Value, i, 1) <> Chr(10) Then
If Mid(ref.Value, i, 1) <> BF Then
s = s & Mid(ref.Value, i, 1)
Else
For j = i + 1 To Len(ref.Value)
If Mid(ref.Value, j, 1) = BE Then
i = j
Exit For
End If
Next
End If
End If
Next
NewEval = Application.Evaluate(s)
End Function
使用时,只要在单元格中输入:
=NewEval(C1),其中C1是你的那种公式所在的单元格的引用
效果如图
附件请参考