Ask Your Question

Function that returns an array values [closed]

asked 2016-11-30 12:21:23 +0100

Iniziato gravatar image

updated 2020-09-16 09:54:53 +0100

Alex Kemp gravatar image

Hello! I would like to writer in Calc (macro) a function, which result is an array of values

function array(input data)


array(1) = ... array(2) = .... array(3) = ....

end function

Is it possible, in your opinion? :-)

Thank you

Best Regards

SO Windows 7 - Windows 10 SW Libreoffice 5.2.3

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-09-16 09:55:30.186786

1 Answer

Sort by » oldest newest most voted

answered 2016-11-30 15:16:32 +0100

pierre-yves samyn gravatar image

updated 2016-12-01 08:22:29 +0100


It is possible...


Confirm entry using the key combination Ctrl+Shift+Enter


You can call the function from another procedure, eg.:

Sub Main

dim lMyValues(1) as long, lOneValue as long

lMyValues = MyArray(2310)

for each lOneValue in lMyValues
    print lOneValue 
next lOneValue 

End Sub

function MyArray(lValue as long)
MyArray = array(lValue * 2, lValue * 3)
end function


edit flag offensive delete link more


Well Done Thank you Pierre :-) If I want To pass this values to another function in StarBasic, it is Always possible?

Iniziato gravatar imageIniziato ( 2016-11-30 18:29:10 +0100 )edit

See my edit in my answer...

pierre-yves samyn gravatar imagepierre-yves samyn ( 2016-12-01 08:23:27 +0100 )edit

Question Tools

1 follower


Asked: 2016-11-30 12:21:23 +0100

Seen: 1,895 times

Last updated: Dec 01 '16