Hi all,
I wrote a little UDF using the (frankly brilliant) Excel-dna, but I have run into a wall.
The function basically gets a value from another workbook (using a specified workbook name, sheet name, column & row).
A small C# snippet is as follows:
tempFormula = "='" + wProperName + SheetName + "'!" + ColumnName + RowNum.ToString();
retval = XlCall.Excel(XlCall.xlfEvaluate, tempFormula);
When I tell the function to return the "tempFormula"string, and I copy the string to any other cell and calculate that cell, then it works (but Excel gives the normal "Links to 'xyz.xlsm' were not updated because 'xyz.xlsm' was not recalculated before it was last saved" error.
It works perfectly if the workbook in question is the one running the UDF (even for another sheet), but gives #REF! errors for other workbooks.
Please help! Is there any way to tell it to still return the value regardless of whether or not it was recalculated before it was saved?
Thank you!
Morne
PS I have tried LinqToExcel, it worked but it returned the formatted number (for example if you are expressing 10 000 as 10 - i.e. in '000 - then only 10 is returned), and this is problematic.