The value to be returned is indicated where the function sets its own name to the return value. Note: Be careful about using custom functions in spreadsheets that you need to share with others.
Thanks everyone Your post does not comply with Rule 8 of our Forum RULES.
Do not crosspost your question on multiple forums without including links here to the other threads on other forums.
This function will recalculate when you change contents of any cell, excel will recalculate it and its dependants, and next all UDFs that have Application. Unfortunately, formatting changes and changes in drawing layer are not a good reason for excel to calculate something.
So you have either to press F9 or wait till any cell contents changes.
Simply save your excel file that contains your VBA functions as an add-in file (for Excel 2003 or for Excel 2007 ).
Then load the add-in (Tools Add-Ins for Excel 2010 ). Be careful about using custom functions in spreadsheets that you need to share with others.A UDF is simply a function that you create yourself with VBA. Use the function (Appears in the Paste Function dialog box (press Shift F3), under the "User Defined" category).This blog will help you get started with UDFs and show a couple of examples. If you want to use a UDF in more than one workbook, you can save your functions in your own custom add-in. I really appreciate all the footwork you've done here.If you were packaging this for use on a client network, would you be able to bundle everything into an exe to install as an excel add-in? I can follow your steps here and can modify the code, but, without experience in C or COM, I'm unsure how you would go about distributing this to all the users who would want to query your database.Excel allows you to create custom functions, called "User Defined Functions" (UDF's) that can be used the same way you would use SUM(), VLOOKUP, or other built-in Excel functions.