Global function

gbrandreth

Board Regular
Joined
Nov 26, 2009
Messages
51
Hi all

I have a function I want to be available to any s/sheet.

I have saved it as an addin, and activated it in my addin list.

I can see its the in VB editor, but when I use it in a s/sheet, I get #NAME.

It works fine if I copy it into the local s/sheet.

Am I missing something to make it globally available....the code is contained within a module, assuming that is the right type?

Thanks

Graham
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
If it's in a normal module, that should be fine as long as you didn't mark the module or function private. Do you have macros enabled? How are you calling the function and what does the code look like?
 
Upvote 0
The module is named concat1, and does not have any initial decalrations (Private or public)

The code is....

Function Concat1(myRange As Range, Optional myDelimiter As String)
Dim r As Range
Application.Volatile
For Each r In myRange
Concat1 = Concat1 & r & myDelimiter
Next r
If Len(myDelimiter) > 0 Then
Concat1 = Left(Concat1, Len(Concat1) - Len(myDelimiter))
End If
End Function

Basically it allows me to concatenate a range of cells as a range, rather than having to specify them seperately

I am calling the function by entering the folling in a cell....

=concat1(B1:Z1)
 
Upvote 0
Your function works as expected. Check input parameters.
 
Upvote 0
I know my fuction works, my problem is I have to copy it into the s/sheet I want to use it in.

My question is how do I make it available to all spreadsheets without copying it.

I have added it as an addin, but its still not available globally
 
Upvote 0
Put it into PERSONAL.XLSB file.
To make it appear, begin recording some macro and save it into Personal. This way Personal workbook will appear.
 
Upvote 0
Change the name of the module to something else. You should never give a module and function/sub the same name.
 
Upvote 0
I tried Rorya suggestion 1st, and that seems to have solved it. Its now working in all sheets

Thanks for the help

Graham
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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
Back
Top