Solved

Where should I install this function so it is available to my spreadsheets>

Posted on 2016-10-06
4
44 Views
Last Modified: 2016-10-07
I had this question after viewing Convert Macro to Function.

Function CountNumbersOccurence(LookFor As String, TheRange As Range) As Long
Dim xx
Dim yy
Dim x
yy = TheRange.Value
For Each x In yy
    xx = Split(x,LookFor)
    CountNumbersOccurence = CountNumbersOccurence + UBound(xx)
Next x
End Function
0
Comment
Question by:Alex972
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Rob Henson
ID: 41832169
The Function should be placed in a Standard Module, same as you would for a Macro.
0
 
LVL 29

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 41832259
If you want to make this function available for a specific workbook, you will need to place the code on Standard Module of that specific workbook (as suggested by Rob) and save that workbook as macro-enabled workbook.

But if you want to make this function available for all of your workbooks, open a blank workbook --> Place the code on Standard Module of that blank workbook and save the workbook as Excel Add-in (.xlam) and the file will be saved at the default Add-Ins folder and then close the workbook.
Now open another blank workbook and from Developer Tab, click on Add-Ins and choose the Add-in from the available Add-ins and click OK.
This way you can access the function from any workbook you open.
0
 
LVL 1

Author Closing Comment

by:Alex972
ID: 41833786
Thanks
0
 
LVL 29

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41833863
You're welcome Alex! Glad to help.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IT Desktop Support 11 65
VBA copy column paste as value 5 20
Excel formula Sumif not working 4 26
How to display data labels along bottom of a line chart 3 17
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
My experience with Windows 10 over a one year period and suggestions for smooth operation
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now