Solved

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

Posted on 2016-10-06
4
37 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 31

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 28

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
 

Author Closing Comment

by:Alex972
ID: 41833786
Thanks
0
 
LVL 28

Expert Comment

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Splitting out Data 14 28
Excel- VBA help on macros that size columns and rows 7 21
Excel 3 22
How to compare data in excel 5 27
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This article will show you how to use shortcut menus in the Access run-time environment.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

17 Experts available now in Live!

Get 1:1 Help Now