>From your example, there is potentially another way to solve this in Calc 
>formulas.

You can specify a list of references that would then be a single parameter:

=MACRO(A13~D15~C1)

For example,
 
=SUM(A13~D15~C1)

works.



The question is, how does the definition of the macro specify that it accepts a 
reference list, and how does the definition of the macro enumerate the cells in 
the list to determine its result.

If this can be treated as a dimensioned parameter of variable length, then you 
have one way to make this work.

I don't know the macro capabilities well enough to know if there is a 
straightforward way to handle this case.

 - Dennis

PS: In future, it might be possible to also use an in-line array for the 
variable-length parameter list.  It appears that arrays with non-constant terms 
are not yet supported.  E.g.,

=MACRO({A13;D15;C1}) 

doesn't appear to work in LibreOffice Calc at this time.  Again, there needs to 
be some way to work on the individual elements in the array as part of the 
MACRO definition.



-----Original Message-----
From: Grzesiek Sójka [mailto:p...@sojka.co] 
Sent: Wednesday, September 21, 2011 08:39
To: users@openoffice.org
Subject: [users] Re: Help with writing macro

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.
-- 
-----------------------------------------------------------------
To unsubscribe send email to users-unsubscr...@openoffice.org
For additional commands send email to sy...@openoffice.org
with Subject: help

-- 
-----------------------------------------------------------------
To unsubscribe send email to users-unsubscr...@openoffice.org
For additional commands send email to sy...@openoffice.org
with Subject: help

Reply via email to