ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Evaluate text string as formula (https://www.excelbanter.com/excel-programming/414423-evaluate-text-string-formula.html)

AshMorK

Evaluate text string as formula
 
Hi Everyone,

I have the following code to get a a cell linked to another workbook, but
when i call the function it returns a #REF!.
The function is trying, for example, to do the following:
Evaluate (='H:\bravhec\[Book1.xls]Sheet1'!A1)


Function GetRange(FilePath As String, FileName As String, SheetName As
String, _
SourceRange As String)
Dim link As String

'Add formula links to the closed file
link= "='" & FilePath & "\[" & FileName & "]" & SheetName _
& "'!" & SourceRange

Application.CutCopyMode = False
GetRange = Evaluate(Link)
End Function

thanks in advance!


All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com