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
 

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Asdf0qwerty

New Member
Joined
Jul 28, 2010
Messages
19
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:

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,916
Messages
5,514,131
Members
408,985
Latest member
bchaabi

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top