running VBA Functions in spreadsheets

D

DesCF

I created a straight forward VBA function in the VBA Editor that sums
miscellaneous values in my spreadsheet. I tested it by using a message
box to display the answer and it works fine. How do I get it to run in my
spreadsheet? I tried just putting it in a cell prefixed with an equal
sign but that doesn't seem to work. Also I used to be able (in Access) to
run public functions in the Immediate window by prefixing the function
with a question mark and just hitting the return key, but that just
produces the message: 'complie error, sub or function not defined' - is
there some other way?
 
D

Don Guillett

As always, you should post your function for comments. Is it in a REGULAR
module?
 
G

Guest

Make sure it in the "right" place:

Functions are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window
 
D

DesCF

It is located in a module attached to the spreadsheet, i.e. in when I
opened the vba editor there was spreadsheets 1, 2, & 3 - I double-clicked
1 to open the module. I don't have the code in fornt of me at the momment,
but for all intents and purposes it might as well be this:

Public Function DOG() as string

DOG = "DOG"

End Function

How do I use this function in a spreadsheet just to display the 'DOG' for
example ?
 

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