I have an Addin that defines some mathematical functions not available in excel. I have it installed and working as it should in the template worksheet (located in the template workbook), but when I copy the template worksheet which contains the function from the template workbook to a new workbook, the addin seems to stop working and gives me a "#NAME?" error in the cell in which the function is called up.
Does anyone know what is going on? Thanks in advance
EDIT: I should have been more specific. The Add in is for a User Defined Function (UDF) and is located in an xla file. Above, when I refer to a "template workbook", this is actually incorrect. Its a normal workbook (.xls), from which we copy individual worksheets as needed, to a new workbook. I'll call this my 'Master' workbook to differentiate from a 'template'.
Since we have a many different 'Master' workbooks from which we extract specific worksheets on a regular basis, I am trying to automate this process of selecting worksheets to copy (using a checkboxs in a worksheet). Once all the necessary checkboxes are ticked, a button is pressed which creates a new workbook and then imports all the required worksheets from the various master workbooks. The UDF's don't work in this new worksheet.
With some prompting from the responders below and extensive web searches, the problem lies with the UDF function reference itself. Let me explain:
The UDF is defined as:
Public Function Ber(ByVal x As Double) As Double End Function
This works fine in the 'Master' TPLATE.xls workbook. When I copy a sheet from this which contains a cell which has the formula, say "=Ber(A1)", in the new sheet, the formula becomes: "=TPLATE.xls!Ber(A1)".
If I then manually renter the correct UDF in the Cell's formula, it works. I dont want to have to do this.
I have found once promising solution, but cant seem to get it to work: http://www.jkp-ads.com/Articles/FixLinks2UDF00.asp (Note: Click on the arrow in the green box to continue the article)
Are there any ways to ensure that the UDF's in the copied worksheet retain the correct reference to the Addin?
I have tried the following:
Including code to find and replace any text between the "=" sign and the "Ber(A1)" with just "=Ber(A1)" -> Doesn't work
The solution from the link above. -> cant get it to work.
Thanks again for any assistance!