Function CalStr(strS As String) Dim i As Integer Dim Tmp_Text, strText As String On Error Resume Next Tmp_Text = "" For i = 1 To Len(strS) + 1 strText = Mid(strS, i, 1) If (strText Like "[0-9]" Or strText Like "[+*/.%)(-]") Then Tmp_Text = Tmp_Text & strText End If Next i If Tmp_Text = "" Then CalStr = 0 Else CalStr = Evaluate(Tmp_Text) End If End Function