i would like to pass a range value to a function and then return the resulting range value back to my sub.
sub:
Dim nettowertadresse As Range
and
nettowertadresse = searchAdress(Dateiname, CurrentSheet, "Nettowert", Range("A1:BA2"))
function:
Function searchAdress(inputworkbook As String, inputsheet As String, inputsearchtext As String, inputrange As Range) As Range
With Workbooks(inputworkbook).Sheets(inputsheet)
Set searchAdress = inputrange.Find(inputsearchtext, LookIn:=xlValues)
End With
End Function
The first problem is that i don´t get a range value in the function. I think that I need the .adress in searchAdress but it does not work that way. maybe with another object that passes the adress into searchAdress? but in any case i get error 91. please advise on how to return the adress from the found cell in the function back to the variable nettowertadresse in my sub.