Question

I have several workbooks containing calculations and I am making an "automatic overview" combining the data in all those sheets. To find the data I use named ranges. These work fine.
However there is one defined name that does not refer to a range. It is a formula.

What I want is to access the result from that formula (in an open calculations book) from my overview book.

Obviously wb.Names("myNamedFormula").RefersToRange does not work as the name does not refer to a range.
wb.Names("myNamedFormula").Value gives me the formula, but not the result. None of the name's members gets the result.
I tried evaluating the formula using Evaluate(...) but this doesn't work as it should be evaluated in the other workbook.

Does anyone know how to get the result?

Thanks,

ps: I know one possibility is to make the name refer to a range and then do the calculation there, but I don't want that.

Was it helpful?

Solution

I think you will have to use Worksheet.Evaluate rather than Application.evaluate (note that all references in the Named Formula should be fully qualified absolute references). Try this syntax for Evaluate

ansa = Workbooks("Book1.xlsb").Worksheets(1).Evaluate(Workbooks("Book1.xlsb").Names("AddNumbers").RefersTo)

OTHER TIPS

This is a bit of a cludge, but:

Add a formual to a cell in the calculation wb =MyNamedFormula (Lets assume as an example cell A1 on Sheet1)

Add a Name in calculation wb PointsToMyNamedFormula that refers to Sheet1!A1

Then you can reference wb.Names("PointsToMyNamedFormula").RefersToRange.Value1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top