Thread: Two questions
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jerry W. Lewis Jerry W. Lewis is offline
external usenet poster
 
Posts: 837
Default Two questions

As Tom and I both noted, Regress only accepts worksheet cell range
references as input for x and y. Alternately, everything calculated by
the ATP regression tool is either directly returned by the LINEST
worksheet function, or is easily computable from the values returned by
LINEST. You can call LINEST in VBA as Application.LinEst( ) and you can
pass arrays to LINEST.

Jerry

P. Dileepan wrote:

How can I pass an array as a range? Here is a sample
code:
============================
For i = 1 To n
X(i, 1) = i
X(i, 2) = i*i
Next

AddIns("Analysis ToolPak - VBA").Installed = True
Application.Run "ATPVBAEN.XLA!Regress", Range
(dataRange), _
X, False, False, , "temp", False, False, _
False, False, , False
==============================

The y-range is fine, but X is an array and I am getting
an error. How can I pass X as a "contiguous reference"?