How to create custom functions in excel?

Asdf0qwerty

New Member
Joined
Jul 28, 2010
Messages
19
Hi everyone,

I'm a newbie in using Excel and VBA. I've made this VBAProject that uses a UserForm. The program accepts user inputs from the TextBoxes which are processed then displays the output unto another TextBox.

Now I'm planning to improve the functionality of my current VBAProject by having the program work in the actual worksheet. Instead of using TextBoxes, the program will get inputs directly from a cell / cell range of an Excel Worksheet and display the computed result in a specified cell where the program is called. Much like how predefined excel functions work, right? So, is it possible to create custom functions in Excel 2007 (like the =Sum(), =Avg())?

Hope you can help me out asap. TIA. :D
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi again everyone,

I have a new problem connected to the first one :D. So I've migrated my codes (global vars and sub procs) from the UserForm into the Module where I've created my UDF Add-in.

Previously, I have these Excel Worksheets (with data tables) that acts as a database for my VBAProject. I lookup values in these Worksheets so that I could perform the program's needed computations.

So we go to the problem. After saving the program as an Excel Add-In and after installation of the Add-In, I can no longer access / view the Worksheets that I've created (View Objects). In addition, when I debug the UDF Add-in, it terminates when ever it reaches statements having to do with calling Worksheet functions:

e.g. Range(varWorkSheetName + "!A4:A9").Find(valType, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)

In short, I can't run my Add-In :D. So how do I solve this? Hope you could help me out again asap. TIA
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,956
Members
449,057
Latest member
FreeCricketId

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