Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old November 16th 07, 10:31 AM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Feb 2008
Posts: 19
Default Spreadsheet does not recognize my VBA function

I have written a simple function (just for test) (opening VBA with alt-F11):

Public Function XX()
XX = 7.45
End Function

but when I use it in a cell - it just shows #NAME?

How do I make the function known to my sheet?

What could be wrong?

  #2   Report Post  
Old November 16th 07, 11:16 AM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 11,058
Default Spreadsheet does not recognize my VBA function

Your UDF works. May not be in a standard module:
User Defined Functions (UDFs) 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

If you save the workbook, the UDF will be saved with it.

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the UDF from Excel:

=XX()

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

or

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx
for specifics on UDFs





--
Gary''s Student - gsnu200756


"RSunday" wrote:

I have written a simple function (just for test) (opening VBA with alt-F11):

Public Function XX()
XX = 7.45
End Function

but when I use it in a cell - it just shows #NAME?

How do I make the function known to my sheet?

What could be wrong?



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
Printer does not recognize the end of an Excel spreadsheet GrandmaMimi Excel Discussion (Misc queries) 2 May 22nd 09 11:05 PM
Can a spreadsheet recognize the current directory it is in? Dable Excel Discussion (Misc queries) 5 April 20th 09 06:22 PM
Function to recognize 1st of month? terryc[_2_] Excel Worksheet Functions 10 February 1st 09 04:57 AM
IF Function doesn't recognize TRUE AMY Z. Excel Worksheet Functions 6 October 24th 06 11:28 PM
Trimming Spreadsheet. How to get excel to recognize only used spa Mark Excel Discussion (Misc queries) 1 April 1st 05 02:50 PM


All times are GMT +1. The time now is 02:25 AM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017