展开全部
Function JiSuan(Rng As Range) As Single
Dim Reg As New RegExp
Dim R As String
On Error GoTo ErrHand
R = (Rng)
Reg.Global = True
Reg.Pattern = "[\u4e00-\u9fa5]|m|M"
R = Reg.Replace(R, "")
Reg.Pattern = "×"
R = Reg.Replace(R, "*")
RegSZCC R
RegSZJJ R
JiSuan = Round(CSng(R), 4)
Set Reg = Nothing
Exit Function
ErrHand:
JiSuan = Err.Description
End Function
Sub RegSZCC(ByRef S As String)
Dim Reg As New RegExp
Dim MS
Dim R As String
Reg.Pattern = "(\d+\.{0,1}\d*)(\*|\\)(\d+\.{0,1}\d*)"
Set MS = Reg.Execute(S)
If MS.Count = 1 Then
If MS(0).SubMatches(1) = "\" Then
R = Format(CSng(MS(0).SubMatches(0)) / CSng(MS(0).SubMatches(2)), "0.00000")
Else
R = Format(CSng(MS(0).SubMatches(0)) * CSng(MS(0).SubMatches(2)), "0.00000")
End If
S = Reg.Replace(S, R)
RegSZCC S
End If
End Sub
Sub RegSZJJ(ByRef S As String)
Dim Reg As New RegExp
Dim MS
Dim R As String
Reg.Pattern = "(\d+\.{0,1}\d*)(\+|\-)(\d+\.{0,1}\d*)"
Set MS = Reg.Execute(S)
If MS.Count = 1 Then
If MS(0).SubMatches(1) = "+" Then
R = Format(CSng(MS(0).SubMatches(0)) + CSng(MS(0).SubMatches(2)), "0.00000")
Else
R = Format(CSng(MS(0).SubMatches(0)) - CSng(MS(0).SubMatches(2)), "0.00000")
End If
S = Reg.Replace(S, R)
RegSZJJ S
End If
End Sub
EXCEL中调用方e69da5e887aa62616964757a686964616f31333365633839法
B1=jisuan(A1)