View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Use of array formula

You can store the array result of LINEST in a Variant (the single
Variant will contain an array of Doubles). You can put that array to a
range of cells or directly access the elements of the array:

Dim Res As Variant
Dim Dest As Range

Set Dest = Range("L1:M5")
Res = Application.WorksheetFunction.LinEst( _
Range("A2:A10"), Range("B2:B10"), True, True)
' put to worksheet
Dest = Res

' access array directly
Dim R As Long
Dim C As Long
For R = 1 To 5
For C = 1 To 2
Debug.Print Res(R, C)
Next C
Next R

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]




On Mon, 8 Feb 2010 10:51:01 -0800, hsPipe wrote:

I would like to use the worksheetfunction.linEst function in excel VBA, but
need help on how to identify that the function returns an array rather than a
single value. Thank you.