Ich möchte diesen Code als Funktion implementieren. Habe eine suchfunktion aus diesem Forum eingebaut. Funktioniert recht gut als Makro mit Texteingabe für den Suchstring, aber in dieser Funktion findet er nie die gesuchten Einträge obwohl vorhanden (und vom Makro gefunden). Kann mir jemand helfen?
Function plgrowth() As Variant
Application.Volatile
Dim pl As String
Dim oldValue As Variant
Dim newValue As Variant
Dim suchErg As Variant
pl = Application.Caller.Offset(0, -3).Value
oldValue = Application.Caller.Offset(0, -2).Value
newValue = Application.Caller.Offset(0, -1).Value
Sheets("Translation").Activate
Set suchErg = Sheets("Translation").Cells.Find(pl)
If Not suchErg Is Nothing Then
plgrowth = "Error"
Else
If ((oldValue = 0) Or (newValue = 0)) Then
plgrowth = ""
Else
plgrowth = (newValue / oldValue) - 1
End If
End If
Set suchBereich = Nothing
End Function