#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default UDF

Assuming your UDF is something like:
Public Function AddMe(arg1 As Double, arg2 As Double, arg3 As Double) As
Double
AddMe = arg1 + arg2 + arg3
End Function

And you are calling it from a cell with:
=addme(D18,15.45,RAND()*10)

It will work.

Of course your VBA code has be valid and return the correct answer/data
type.
It would be better to type your arguments and return value to avoid working
with Variants. See the example below, assuming your UDF code, in A1:C2.

=duration(B1,C1) One Word
=duration(B2,C2) 1 2

Which is correct ?

NickHK

"Arne Hegefors" wrote in message
...
Hi! I am trying to write a simple udf that takes three parameters as
argument. never mind what the udf is supposed to do, i just cant get it to
work for more than one argument. pls help me!

Function duration(n, t)
duration = n + t
End Function

This works for one argument (i then skip the t in the duartion line). pls
help!



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



All times are GMT +1. The time now is 09:12 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"