Aufruf einer UDF, Fehler Objekt erforderlich
29.03.2007 18:25:00
Christian
ich habe fogende UDF:
Function New_SumProduct(x As String, y As String) As Variant
Dim strMonat As String
Dim strArt As String
Dim strSumme As String
Application.Volatile
intLastRow = Sheets("Tabelle1").Range("F65536").End(xlUp).Row
strMonat = Application.Caller.Parent.Range("Tabelle1!A5:A" & intLastRow).Address ' contains _
_
text
strArt = Application.Caller.Parent.Range("Tabelle1!C5:C" & intLastRow).Address ' contains _
_
text
strSumme = Application.Caller.Parent.Range("Tabelle1!F5:F" & intLastRow).Address ' _
contains values
New_SumProduct = _
Evaluate("SUMPRODUCT((" & strMonat & "=" & Chr(34) & x & Chr(34) & ")*(" & strArt & "=" & _
_
Chr(34) & y & Chr(34) & ")*" & strSumme & ")")
End Function
Im Tabellenblatt funktioniert die auch einwandfrei, wenn ich sie aber im VBE mit z.B.
Range("K1") = New_SumProduct("x", "y")
aufrufen will kommt bei der Zeile
strMonat = Application.Caller.Parent.Range("Tabelle1!A5:A" & intLastRow).Address
die Fehlermeldung Laufzeitfehler 424, Objekt erforderlich.
Weiss jemand was ich falsch mache?
Vielen Dank!
Christian