Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default User-Defined Excel Functions

Anyone know where I can find info on creating user defined
excel fuctions?

Just as a rudimentary example:
---------------------
Public Function Test(ByVal dAmt As Double) As Double

Test = dAmt * 2

End Function
------------------
This returns the "#VALUE!" error message. Never done an
excel UDF, so I've no idea what I'm doing wrong (or even
right).

Thanks in advance,

Sean
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default User-Defined Excel Functions

Sean,

I think by definition a UDF has to be by reference. So I would delete hte
"ByVal" and see if it works.

Regards,
Kevin


"Sean" wrote in message
...
Anyone know where I can find info on creating user defined
excel fuctions?

Just as a rudimentary example:
---------------------
Public Function Test(ByVal dAmt As Double) As Double

Test = dAmt * 2

End Function
------------------
This returns the "#VALUE!" error message. Never done an
excel UDF, so I've no idea what I'm doing wrong (or even
right).

Thanks in advance,

Sean



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default User-Defined Excel Functions

Thanks for the help, but it doesn't work either (I had
tried it byref, byval, with nothing).

I have tried boilerplate examples from MS, but they return
the same error.

Is there an option or setting I need to adjust? I can find
nothing under Tools--Options.
-----Original Message-----
Sean,

I think by definition a UDF has to be by reference. So I

would delete hte
"ByVal" and see if it works.

Regards,
Kevin


"Sean" wrote in

message
...
Anyone know where I can find info on creating user

defined
excel fuctions?

Just as a rudimentary example:
---------------------
Public Function Test(ByVal dAmt As Double) As Double

Test = dAmt * 2

End Function
------------------
This returns the "#VALUE!" error message. Never done an
excel UDF, so I've no idea what I'm doing wrong (or even
right).

Thanks in advance,

Sean



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default User-Defined Excel Functions

Hi Sean

This works for me.

Option Explicit

Public Function Test(dAmt As Double) As Double

Test = dAmt * 2

End Function



In the spreadsheet, I entered in a cell, =Test(5)

The answer was 10.

So it works as planned.

If you have difficulty, I can send my sample spreadsheet.

Regards,
Kevin



"Sean" wrote in message
...
Thanks for the help, but it doesn't work either (I had
tried it byref, byval, with nothing).

I have tried boilerplate examples from MS, but they return
the same error.

Is there an option or setting I need to adjust? I can find
nothing under Tools--Options.
-----Original Message-----
Sean,

I think by definition a UDF has to be by reference. So I

would delete hte
"ByVal" and see if it works.

Regards,
Kevin


"Sean" wrote in

message
...
Anyone know where I can find info on creating user

defined
excel fuctions?

Just as a rudimentary example:
---------------------
Public Function Test(ByVal dAmt As Double) As Double

Test = dAmt * 2

End Function
------------------
This returns the "#VALUE!" error message. Never done an
excel UDF, so I've no idea what I'm doing wrong (or even
right).

Thanks in advance,

Sean



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default User-Defined Excel Functions

GRRR!

I hate it when it turns out to be something silly.

I never put in "Option Explicit"

Thanks Kevin

-----Original Message-----
Hi Sean

This works for me.

Option Explicit

Public Function Test(dAmt As Double) As Double

Test = dAmt * 2

End Function



In the spreadsheet, I entered in a cell, =Test(5)

The answer was 10.

So it works as planned.

If you have difficulty, I can send my sample spreadsheet.

Regards,
Kevin



"Sean" wrote in

message
...
Thanks for the help, but it doesn't work either (I had
tried it byref, byval, with nothing).

I have tried boilerplate examples from MS, but they

return
the same error.

Is there an option or setting I need to adjust? I can

find
nothing under Tools--Options.
-----Original Message-----
Sean,

I think by definition a UDF has to be by reference.

So I
would delete hte
"ByVal" and see if it works.

Regards,
Kevin


"Sean" wrote in

message
...
Anyone know where I can find info on creating user

defined
excel fuctions?

Just as a rudimentary example:
---------------------
Public Function Test(ByVal dAmt As Double) As Double

Test = dAmt * 2

End Function
------------------
This returns the "#VALUE!" error message. Never done

an
excel UDF, so I've no idea what I'm doing wrong (or

even
right).

Thanks in advance,

Sean


.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default User-Defined Excel Functions

Hi Sean:

While the use of Option Explicit is highly recommended, it should have had
no impact in this case, unless you misspelled a variable.

Regards,

Vasant.

"Sean" wrote in message
...
GRRR!

I hate it when it turns out to be something silly.

I never put in "Option Explicit"

Thanks Kevin

-----Original Message-----
Hi Sean

This works for me.

Option Explicit

Public Function Test(dAmt As Double) As Double

Test = dAmt * 2

End Function



In the spreadsheet, I entered in a cell, =Test(5)

The answer was 10.

So it works as planned.

If you have difficulty, I can send my sample spreadsheet.

Regards,
Kevin



"Sean" wrote in

message
...
Thanks for the help, but it doesn't work either (I had
tried it byref, byval, with nothing).

I have tried boilerplate examples from MS, but they

return
the same error.

Is there an option or setting I need to adjust? I can

find
nothing under Tools--Options.
-----Original Message-----
Sean,

I think by definition a UDF has to be by reference.

So I
would delete hte
"ByVal" and see if it works.

Regards,
Kevin


"Sean" wrote in
message
...
Anyone know where I can find info on creating user
defined
excel fuctions?

Just as a rudimentary example:
---------------------
Public Function Test(ByVal dAmt As Double) As Double

Test = dAmt * 2

End Function
------------------
This returns the "#VALUE!" error message. Never done

an
excel UDF, so I've no idea what I'm doing wrong (or

even
right).

Thanks in advance,

Sean


.



.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default User-Defined Excel Functions

Putting it in a general module rather than a worksheet module would be
important. It worked fine in a general/standard module for me (without
using Option Explicit).

--
Regards,
Tom Ogilvy


"Sean" wrote in message
...
GRRR!

I hate it when it turns out to be something silly.

I never put in "Option Explicit"

Thanks Kevin

-----Original Message-----
Hi Sean

This works for me.

Option Explicit

Public Function Test(dAmt As Double) As Double

Test = dAmt * 2

End Function



In the spreadsheet, I entered in a cell, =Test(5)

The answer was 10.

So it works as planned.

If you have difficulty, I can send my sample spreadsheet.

Regards,
Kevin



"Sean" wrote in

message
...
Thanks for the help, but it doesn't work either (I had
tried it byref, byval, with nothing).

I have tried boilerplate examples from MS, but they

return
the same error.

Is there an option or setting I need to adjust? I can

find
nothing under Tools--Options.
-----Original Message-----
Sean,

I think by definition a UDF has to be by reference.

So I
would delete hte
"ByVal" and see if it works.

Regards,
Kevin


"Sean" wrote in
message
...
Anyone know where I can find info on creating user
defined
excel fuctions?

Just as a rudimentary example:
---------------------
Public Function Test(ByVal dAmt As Double) As Double

Test = dAmt * 2

End Function
------------------
This returns the "#VALUE!" error message. Never done

an
excel UDF, so I've no idea what I'm doing wrong (or

even
right).

Thanks in advance,

Sean


.



.



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
does Excel 07 allow User Defined functions? doc_grandma Excel Worksheet Functions 1 September 21st 09 11:16 PM
How to add user defined functions in excel permanantly Sandeep Jangra Excel Discussion (Misc queries) 2 October 10th 08 09:44 AM
I have had difficulty in creating user defined functions in Excel MichaelG Excel Worksheet Functions 3 July 13th 05 11:59 AM
Excel user defined functions. Matt Excel Worksheet Functions 4 March 15th 05 07:22 PM
Help for User Defined Functions in Excel 2003 Beta R Kalal Excel Programming 0 July 29th 03 04:58 PM


All times are GMT +1. The time now is 01:26 AM.

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

About Us

"It's about Microsoft Excel"