Excel 97 VBA: array(arghh_list)
Posted on 2001-07-01
I have asked this question in another site, but got no replies, not to speak of a solution.
How do I generate an arglist with Excel 97 / VBA ? The code below for an array formula is an example only, the wanted method #2 seems to be necessary to pass calculated and/or 'non-adjacent' x datapoints to LINEST, I am trying to automate a multiple regression _w/o_ pasting the auxiliary data to a worksheet range.
Function Arghh_list(myRange As Range, iWhich As Integer) as Variant
Dim arrDefault As Variant, arrHowTo As Variant, arrNotThis As Variant
Dim arglist As Variant
Select Case iWhich
arrDefault = Array(1, 4, 9, 16)
Arghh_list = arrDefault
'How to generate arglist of form 'arg1, arg2, arg3,..., argN' ?
'arglist = ????
arrHowTo = Array(arglist)
Arghh_list = arrHowTo
'Ordinary array, filled with the values of the passed range
arrNotThis = myRange.Value
Arghh_list = arrNotThis
MsgBox "check syntax"