How do I store my VBA UDF?

  • Thread starter Thread starter cec34
  • Start date Start date
C

cec34

I'm an old-time programmer, but new to VBA in Excel 2007. I've written a
UDF, but so far, I haven't figured out how to test it in the Immediate window
(or the worksheet, for that matter). It compiles without error, but how do I
store it to make it accessible to the associated worksheet?
 
Don't store it in a Worksheet Module, but in a General Module. So, from the
VBA menu: Insert>Module and paste the code there.
Now you can call it from a worksheet as if it were a built-in Excel
function.
If you need to acces it from other workbooks or even distribute it: read
this:

http://www.jkp-ads.com/Articles/DistributeMacro00.asp

It says it is about macros, but most of it is true for functions as well
 
Put it in a standard module.

From the VBA window:

Insert > Module

then paste the stuff in. Consider making the UDF Public.
 
Thanks! That's what I needed.

cec34

Gary''s Student said:
Put it in a standard module.

From the VBA window:

Insert > Module

then paste the stuff in. Consider making the UDF Public.
 
Back
Top