User defined (macro) formula not Transferring when moving tab

cubsfan05

New Member
Joined
Jun 10, 2013
Messages
32
Office Version
  1. 365
Platform
  1. Windows
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?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
39,061
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. 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
32
Office Version
  1. 365
Platform
  1. Windows
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
39,061
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. 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,171,720
Messages
5,877,125
Members
433,233
Latest member
Haripriya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top