UDFs: The difference between function and public function?

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Re: UDFs: The difference between function and public functio

A User Defined Function's scope is defaulted to Public, so if you don't specify Public it will still be regarded as Public by Excel. Public means for UDFs what it means for other declarations, that being the function can be accessed by other procedures in other modules in the workbook. Private scope makes the UDF accessible to procedures in the same module. The other optional scope is called Static, which keeps the variables' values unchanged between function calls.

A Private UDF does not appear in the Function dialog (something I personally never use anyway), and it is usually specified so a user does not attempt to use it as a formula because the workbook author's intent for the UDF is to support other VBA procedures.

Bottom line to your specific question, Public is the default scope so you can leave it out if you want the UDF to be Public.
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,643
Members
449,093
Latest member
Ahmad123098

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