call a vb function from a cell

M

mike grasso

Hi

I have a function that i want ot use in a xcel formula?
can this be done
my function...
Public Function myfun(str As String) As String
myfun = "xxxx"
End Function

How do i call it from a cell
i tried in excel spreadsheet cell
=myfun("helloworld")
but this does not work is it possible?

thanks mike
 
M

MSP77079

instead of just typing in =myfun("helloworld")

you should click in Insert > Function, then select your function fro
the "All" list
 
M

mike grasso

Hi I cant see the function,
I want to call a function I have written!
not a standard excel function!
The all list only lists excel functions, where
should i define my vb function to appear in this ALL
list? i can see it!

HELP
 
T

Tom Ogilvy

Put it in a general module rather than a sheet module or the thisworkbook
module.

Make sure it isn't declared as private.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top