Reputation: 23
I have a simple question concerning references in excel formulas and VBA.
I am currently taking a course in asset pricing with applications in VBA. As I am very new to VBA, I have become very frustrated about a certain problem concerning solution sheets from my lecturer with reference to directories on his computer.
In the course we're gradually expanding a set pricing library called analytics.xlsm
and as I understand this is a macro-enabled workbook. Within the project, there is a module containing pricing functions.
So, when I download my lecturer solution sheets all of the formulas containing pricing functions are referenced to a directory on his computer. As I understand, this is a 'link'. When I open the workbook, I have the option to change the link to my own analytics.xlsm
.
I have tried this, among other things, but all I get is the #NAME?
value in every cell referenced from or containing a function from analytics.xlsm
.
I've tried the following in different orders and combinations:
analytics
add-in;Reference
under the Tools
menu in the VBA interface to analytics.xlsm
;I hope that someone in here can help me understand how this works. Ideally, I would just want to download his solution workbook with formulas containing only the function written in the pricing module in which case I could just load analytics.xlsm
as an add-in. This works when I solve the assignments myself.
Example:
I want
=swaprate(..,..,.....)
instead of
='machintosh......analytics.xlsm!swaprate(..,..,.....)
I'm using excel for MAC and so is my lecturer. Thank you in advance!
Upvotes: 2
Views: 69
Reputation: 12655
The reason why this happens is that the add-in file containing the function swaprate()
is local. In other words:
analytics.xlsm
with his Excel; his Excel is using an add-in, let's call it functions.xlam
, and this file is stored on his local machine: for example, C:\Lectures\Financials\functions.xlam
analytics.xlsm
, for example he writes in A1
the function =swaprate(1,2,3)
.analytics.xlsm
(which contains the function swaprate()
referencing to his local add-in) gets the originary source path 'C:\Lectures\Financials\functions.xlam'
before the name of the function. So, technically (to test), the solution to update the link should be:
'C:\Student\functions.xlam!'swaprate()
) it means that this particular add-in (lying on C:\Student\
) is not active. You can activate it by Options/Add-Ins menu of Excel.Upvotes: 1