代 Option Explicit Function MSum(ByVal MyStr As String) As Double Dim I% Dim MyVal As Double With CreateObject("Vbscript.Regexp") .Global = True .Pattern = "\d+" If .test(MyStr) Then For I = 1 To .Execute(MyStr).Count MyVal = MyVal + Val(.Execute(MyStr)(I - 1)) Next End If End With MSum = MyVal End Function