Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2016-10-06
4
46 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 33

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 30

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 30

Expert Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

789 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