Re: Help with writing macro

Johnny Rosenberg <[email protected]>
Newsgroups gmane.comp.openoffice.questions
Message-ID <CADo7T4czNbwvjCoaUt+SWnMoWieJt3L+sDJxNVhKTBo0TYHGsA@mail.gmail.com>
2011/9/21 Grzesiek Sójka <[email protected]>:
> On 09/21/11 17:08, Johnny Rosenberg wrote:
>
>> Can you give an example? I'm not sure what you mean by ”accepting
>> variable length parameter list”.
>
> I do need to get some kind of statistic-like data. So I can not make any
> assumptions on the number of the results specified. Lets say that my macro
> is called "MACRO". It should be possible to put in the spreadsheet cell
> something like:
> =MACRO(A13;D15;C1)
> and also:
> =MACRO(A2;D1)
> Then our MACRO should return some kind of numerical data calculated using
> all the values from all the cells specified. For the star it may be for
> example the sum of all values.
>
>> What is the user supposed to do and
>> what is the macro supposed to do with it? Is the macro supposed to run
>> in Calc, Writer or what?
>
> It should be used in Calc.

I haven't done this myself, but I would try to use ”Optional” and
”IsMissing”, something like this:

Function MyFunction(A As Double, Optional B As Double, Optional C As
Double) As Double
'	Some code
	If IsMissing(B) Then
'		Do something
	EndIf
	More code
End Function



Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ
-- 
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.