Gruppe
UDF
Problem
Aus Zeichenfolgen sollen Werte ausgelesen und berechnet werden.
StandardModule: basMain
Function Wertgehalt(sTxt As String)
Const csChars As String = "0123456789+-()*/^."
Dim iChr As Integer
Dim sFormula As String
sTxt = WorksheetFunction.Substitute(sTxt, ".", "")
sTxt = WorksheetFunction.Substitute(sTxt, ",", ".")
For iChr = 1 To Len(sTxt)
If InStr(csChars, Mid(sTxt, iChr, 1)) Then
sFormula = sFormula & Mid(sTxt, iChr, 1)
End If
Next iChr
Wertgehalt = Evaluate(sFormula)
End Function