I am stuck with a problem. i have a range of cells that contain the paths to external work books, all of which contain a same named range. E.g. in a workbook in cell B2, i have a text string reading 'C:\test\test.xlsm'. In that specific file i would have a named range called 'namedrange'. Now i would like to refer to this namedrange using a function to be created in VBA. I want to use the 'INDEX' function to refer to external, closed workbooks. However, INDEX won't allow me to refer to cells to create that reference. I would need to use INDIRECT: however, INDIRECT won't allow me to use INDEX with closed workbooks. So how would i approach this? I have tried to create function called 'reference' which would link to cell B2, and then use e.g. INDEX(Reference(B2),1,1) to refer to the external workbook' namedrange row 1 column 1. But this doesnt work. Does anyone has any idea? Similarly, I would like to use the function MATCH with these Reference. Much appreciated!
Function Reference(stradd As String) As Range
Reference = Workbooks(stradd).Range("namedrange")
End Function