Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
does Excel 07 allow User Defined functions? | Excel Worksheet Functions | |||
How to add user defined functions in excel permanantly | Excel Discussion (Misc queries) | |||
I have had difficulty in creating user defined functions in Excel | Excel Worksheet Functions | |||
Excel user defined functions. | Excel Worksheet Functions | |||
Help for User Defined Functions in Excel 2003 Beta | Excel Programming |