Hallo Leute,
Es wurde mir eben in einem anderen Forum gesagt was falsch ist. So was blödes^^ Und zwar hat mein end den Error ausgegeben, das musste stattdessen ein "exit function" hin.
Falls jemand auch irgendwan mal dieses Problem haben sollte, hier die Lsg:
Function EingabefktTyp4(z1, z2, x1, y1, ParamArray parray() As Variant) As String
If z1 <> "" And z2 <> "" Then 'red2
If IsArray(x1) Or IsArray(y1) Then 'red3
If IsArray(x1) And IsArray(y1) Then 'red4
If UBound(parray()) <> -1 Then 'blue1
EingabefktTyp4 = ("Zu viele Parameter")
Exit Function
Else 'red5
If x1(1) = "" Or y1(1) = "" Then 'blue2
EingabefktTyp4 = ("Zu wenig Parameter")
Exit Function
Else 'red6
'MsgBox x1.Count
'MsgBox y1.Count
If x1.Count = y1.Count Then 'blue3
'HIER RECHNEN MIT RANGES!
'MsgBox "rechnung mit ranges"
EingabefktTyp4 = (x1(x1.Count) & y1(y1.Count))
Else 'blue4
EingabefktTyp4 = ("Ranges nicht gleich groß!")
Exit Function
End If
End If
End If
Else 'blue5
If IsArray(x1) = False Then 'blue 5,5
EingabefktTyp4 = ("x1 ist kein Rangeobject")
Exit Function
End If
If IsArray(y1) = False Then ' blue 5,6
EingabefktTyp4 = ("y1 ist kein Rangeobject")
Exit Function
End If
EingabefktTyp4 = ("x1 und y1 müssen Range oder Einzelwert sein, Paramarray muss dabei leer gelassen werden!")
Exit Function
End If
Else 'red 7
'MsgBox "red7"
If x1 <> "" And y1 <> "" Then 'red8
If UBound(parray()) <> -1 Then 'blue6
EingabefktTyp4 = ("zu viele Parameter")
Exit Function
Else 'blue7
'Rechnung mit einzelwerten x1, y1
'MsgBox "Rechnung mit einzelwerten"
EingabefktTyp4 = (x1 & y1)
End If
Else 'red8,5
'MsgBox (UBound(parray))
If x1 <> "" Or y1 <> "" Then 'blue7,5
EingabefktTyp4 = ("x1 und y1 müssen für die Verwendung von Parray beide leer sein!")
Exit Function
Else 'red9
If UBound(parray()) <> -1 Then 'red10
'MsgBox "red10"
If (((UBound(parray) + 1) Mod (2)) = 0) Then 'blue8
'Rechnung mit Paramarray!
'MsgBox "rechnung mit paramarray"
EingabefktTyp4 = (parray(UBound(parray())))
Else 'blue9
EingabefktTyp4 = ("Parameterzahl ungerade")
Exit Function
End If
Else 'blue10
EingabefktTyp4 = ("zu wenig Werte")
Exit Function
End If
End If
End If
End If ' ??? von red 8,5
Else 'blue11
EingabefktTyp4 = ("z1 oder z2 falsch")
Exit Function
End If
Exit Function
'error1:
'MsgBox "In den Feldern X1, Y1 müssen immer Werte stehen. Falls keiner eingestzt werden soll, bitte "" verwenden!"
End Function
|