Solved

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

Posted on 2016-10-06
4
52 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
[X]
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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

726 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