Home » Questions » Computers [ Ask a new question ]

How can I create a reusable function in Excel 2007?

How can I create a reusable function in Excel 2007?

How can I create a resuable function/formula I can use in formulas in a spreadsheet? In particular I need a very simple DateDiff formula and would like a way to encapsulate this function:

Asked by: Guest | Views: 365
Total answers/comments: 1
Guest [Entry]

"This link completely describes how to do it... instructions have been enumerated below:

Open up a new workbook.
Get into VBA (Press Alt+F11)
Insert a new module (Insert > Module)
Enter the Excel User Defined Function (UDF) in VBA
Get out of VBA (Press Alt+Q)
Use the functions (in the worksheet) - They will appear in the Paste Function dialog box, Shift+F3, under the ""User Defined"" category)

It's for Excel-2003, but the process is the same

You create a VBA module with a function, say NEWfunction,
then reference it in the cell, =NEWfunction(""A1"")."