Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with UDF


I need to implement some simple UDFs in VBA. I programmed the UDF but Excel doesn't appear to recognize their existence fully.

I get #Name? in the cell and the UDF does not show up in the function list nor does any indication of user defined functions. I copies a simple example from the web to calculate the area of a rectangle with the same result. Excel knows that it exists because when Excel starts it asks if I want to enable marcos and it shows up on the object browser. I was under the impression that once you write a UDF in VBA, it is immediately available. What am I doing wrong?

An example is:

Public Function pfd(Llambda As Double, test_interval As Double) As Double

pfd = 1 - Exp(-Llambda * test_interval / 2)

End Function

The function is in the ThisWorkBook module.

Thanks ahead of time for any help.

Bill Mostia
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Problem with UDF

Bill

Move the Function to a General Module.

InsertModule and paste in there.

Gord Dibben Excel MVP

On Thu, 11 Dec 2003 16:56:10 -0800, "wlmostia" wrote:


I need to implement some simple UDFs in VBA. I programmed the UDF but Excel doesn't appear to recognize their existence fully.

I get #Name? in the cell and the UDF does not show up in the function list nor does any indication of user defined functions. I copies a simple example from the web to calculate the area of a rectangle with the same result. Excel knows that it exists because when Excel starts it asks if I want to enable marcos and it shows up on the object browser. I was under the impression that once you write a UDF in VBA, it is immediately available. What am I doing wrong?

An example is:

Public Function pfd(Llambda As Double, test_interval As Double) As Double

pfd = 1 - Exp(-Llambda * test_interval / 2)

End Function

The function is in the ThisWorkBook module.

Thanks ahead of time for any help.

Bill Mostia


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with UDF


Thanks, moving it to a general module worked like a charm.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM


All times are GMT +1. The time now is 11:46 PM.

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"