How to create a function in a code sheet

  • Thread starter Thread starter Mathieu936
  • Start date Start date
M

Mathieu936

Hi!

I need to create a function that I will use in a worksheet. However,
I need to create it in a worksheet code (not in a separate module, but
in the "Microsoft Excel Objects").

I know it works for a macro, but not for a function. I tried to call
my function with "private function", "public function", but it doesn't
work.

Thanks for your help guys!

Mathieu
 
Hi Mathieu

Why on earth do you "need to create it in a worksheet code, not in a
separate module" ? Insert a regular module and write your function, end
users don't care where or how functions are written.

HTH. Best wishes Harald
 
Hi Mathieu

If you put the line below in the separate module your users will not
find the function in the list of t category User Defined

Option Private Module.


HTH,

Wouter
 
I want to include the functions in the worksheet code because I have
to copy the worksheet, and I don't want to copy a module with it.
That's the only reason.
 
I want to include the functions in the worksheet code because I have
to copy the worksheet, and I don't want to copy a module with it.
That's the only reason.

anyone has an idea?
 
anyone has an idea?

An alternate approach to worksheet event macro in the sheet. The
macro would:

1. test for the existence of a module called mathieu
2. if the module already exists in the work book, just exit
3. create the module
3. populate the newly created module with any functions or sub you
need.
 
An alternate approach to worksheet event macro in the sheet.  The
macro would:

1. test for the existence of a module called mathieu
2. if the module already exists in the work book, just exit
3. create the module
3. populate the newly created module with any functions or sub you
need.

Thanks James for the idea. Thus I assume there is no way to write a
function in the sheet's code. Too bad!
 
Back
Top