Fehlermeldung #NAME? bei Add-In
17.11.2003 18:21:57
Erich
Ich habe folgendes Add-In aus einem Forum kopiert und installiert
'###########################################################################################
'Zahl aus Text
Function ZahlAusText(Zelle As String) As Double
Dim i%, x As Boolean, Minus As Boolean, Komma As Boolean, Zahl$
x = False
Minus = False
Komma = False
Zahl = ""
For i = 1 To Len(Zelle)
If Mid(Zelle, i, 1) = "-" And IsNumeric(Mid(Zelle, i + 1, 1)) Then
If Minus = True Then GoTo ende
Zahl = "-"
Minus = True
End If
If IsNumeric(Mid(Zelle, i, 1)) Or Mid(Zelle, i, 1) = "," Then
If Mid(Zelle, i, 1) = "," And Komma = True Then GoTo ende
If Mid(Zelle, i, 1) = "," Then Komma = True
x = True
Zahl = Zahl & Mid(Zelle, i, 1)
End If
If Not IsNumeric(Mid(Zelle, i, 1)) And Mid(Zelle, i, 1) <> "," And x = True Then GoTo ende
Next
ende:
If Zahl = "" Then ZahlAusText = 0 Else ZahlAusText = CDbl(Zahl)
End Function
'Herausarbeiten der Zahl
Function ZahlA(Zelle As String) As Variant
Application.Volatile
For i = Len(Zelle) To 1 Step -1
If IsNumeric(Mid(Zelle, i, 1)) Then ZahlA = Mid(Zelle, i, 1) & ZahlA
Next
ZahlA = ZahlA * 1
If ZahlA = 0 Then ZahlA = ""
End Function
Function ZahlB(Zelle As String) As String
Application.Volatile
For i = 1 To Len(Zelle)
If Not IsNumeric(Mid(Zelle, i, 1)) Then
ZahlB = ZahlB & Mid(Zelle, i, 1)
End If
Next
End Function
Bei Eingabe der Formel in B1 =ZahlAusText(A1) kommt die Fehlermeldung #NAME?
In A1 steht Creditanstalt -22.047,16 und ich möchte die Zahl aus diesem Text getrennt in einer Zelle.
Was ist da falsch?
Gruß
Erich