top of page

You are learning Macros in MS Excel

How to use custom functions written in VBA in other spreadsheets?

There are two main ways to use custom functions written in VBA in other spreadsheets:

1. Including the VBA Code in the Workbook:

* This method involves saving the workbook containing the VBA code with your custom functions as a macro-enabled workbook (usually with a `.xlsm` extension).
* When you open this workbook on another computer, the custom functions will be available for use in any of the worksheets within that specific workbook.

Limitations:

* Security concerns: Some users might have macro security disabled to prevent potential malware. You'll need to convince them to enable macros for this method to work.
* Limited accessibility: The function is only usable within that specific workbook on other computers.

2. Creating an Excel Add-In:

* This method involves creating a reusable add-in file (usually with a `.xlam` extension) containing your VBA code and custom functions.
* Once you develop and save the add-in, you can install it on other computers. After installation, the custom functions become available in any Excel workbook on that computer, regardless of where the workbook originated.

Benefits:

* Wider accessibility: The functions are available in any Excel workbook on computers where the add-in is installed.
* Reusability: You can create a single add-in containing multiple functions for wider use.

Considerations:

* Requires some VBA development knowledge: Creating an add-in requires more advanced VBA coding skills compared to simply including the code in a workbook.
* Installation process: Users on other computers might need to follow specific steps to install the add-in.

Choosing the Right Method:

* If your function is specific to a single workbook and you have control over macro security settings, including the code in the workbook might be sufficient.
* If you want a reusable function accessible across different workbooks, creating an add-in is the better option.

bottom of page