User defined (macro) formula not Transferring when moving tab

cubsfan05

New Member
Joined
Jun 10, 2013
Messages
30
I've written a simple formula (below, i don't have excel 2013 with the =formulatext function) on a tab in a standalone model which i then need to drop into a large number of other models. The formula is written on the worksheet in the standalone model (not a module) and it works in the standalone model. However, when I copy the tab into a 2nd, larger workbook, the formula ceases to work and i get a #NAME error as the 2nd, larger workbook isn't recognizing the formula even though when i open VB, i can see the copied tab with the getformulatext function below.

Code:
Function GetFormulaText(myCell As Range)
    GetFormulaText = myCell.Formula
End Function

Any ideas why the 2nd, larger workbook isn't recognizing the formula on the tab that has been copied in?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,351
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
That code is in a normal module, which is not being copied to the other workbook, which is why it doesn't work. It sounds like you need to put it into an add-in.
 

cubsfan05

New Member
Joined
Jun 10, 2013
Messages
30
What do you mean an add-in?
like an excel or com add-in?

Ideally i'll be able to send this one-tab file to coworkers who can then drop it into their many models.
What i need to do is remove the link to a specific file by doing find & replace so that instead of referencing the "output" tab on a template file, it references the output tab in the user's individual existing file. thus i had the macro formula above to pull the file name being referenced so people knew what to find & replace with ""
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,351
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
An Excel add-in (xlam file).
A single sheet won't work because a UDF cannot be stored in a worksheet module.
 

Forum statistics

Threads
1,082,269
Messages
5,364,148
Members
400,783
Latest member
sambills

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top