Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default running VBA Functions in spreadsheets


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?





--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 11,058
Default running VBA Functions in spreadsheets

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

--
Gary''s Student - gsnu200715


"DesCF" wrote:


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?





--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default running VBA Functions in spreadsheets

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 ?






On Tue, 17 Apr 2007 18:03:41 +0100, Don Guillett
wrote:

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




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4,624
Default running VBA Functions in spreadsheets

In article <op.tqyxbkhlupgxg0@descstar, DesCF wrote:

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


You do what Don suggested and use a standard module, that you get by
choosing Insert/Module from the VBE menu.

See http://www.mcgimpsey.com/excel/modules.html
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Excel Spreadsheets be saved as Microsoft Works spreadsheets? EXCEL WORKS CONFUSED Excel Discussion (Misc queries) 4 August 18th 06 11:21 PM
efficiency: database functions vs. math functions vs. array formula nickname Excel Discussion (Misc queries) 2 July 14th 06 04:26 AM
Looking for a site with functions that substitute the ATP functions Franz Verga Excel Worksheet Functions 3 June 24th 06 04:30 AM
Exporting Excel spreadsheets with functions GiggleSwitch Excel Worksheet Functions 2 April 4th 06 01:18 PM
Nesting functions in the functions dialog box cs170a Excel Worksheet Functions 0 June 10th 05 10:36 PM


All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"