.xla addin function

msvec

Board Regular
Joined
Feb 18, 2002
Messages
202
i have an addin that load automatically each time i open excel and it's full of subs that i use regularly and they work fine. i recently tried to add a function to one of the modules in the .xla file and when i'm in a spreadsheet, it won't work. if i move the function to a module specific to the sheet i'm in, no problems, but i would like to be able to include it in my .xla file.

any help in this area would be appreciated.

THANKS
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
At the subroutine to the origianl sheet from which you created the add-in, and then saqve it as an add-in replacing the one with your current macros in it.
 
Upvote 0
At the subroutine to the origianl sheet from which you created the add-in, and then saqve it as an add-in replacing the one with your current macros in it.
 
Upvote 0
At the subroutine to the origianl sheet from which you created the add-in, and then saqve it as an add-in replacing the one with your current macros in it.
 
Upvote 0
I'm not sure i fully understand what you're saying. the addin loads successfully each time i open excel and the code for the function appears correctly. Do you want me to overwrite my existing .xla with a new one that includes this function?
 
Upvote 0
It may be worth posting your function so that someone else can try it in one of their existing addins.
 
Upvote 0
OK, here's the function:

Function countstr(cell_ref As Range, replace_val As String) As String

countstr = (Len(cell_ref) - Len(Replace(cell_ref.Value, replace_val, ""))) / Len(replace_val)

End Function
 
Upvote 0
OK,

I just pasted your function into an add-in (for this purpose I pasted it into the modmenu module of the HTML Maker add-in). The function worked fine.

When you say it doesn't work do you mean it isn't available if you choose Insert, Function. Then choose User Defined from the left hand list. Is the function countstr visible in the right hand list? If so, what doesn't work when you choose that, add the two arguments and click OK?

If the countstr function isn't available can you confirm that you don't have this:-

Option Private Module

anywhere in the module containing the function?
 
Upvote 0

Forum statistics

Threads
1,214,817
Messages
6,121,720
Members
449,050
Latest member
MiguekHeka

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