Can someone tell me what's wrong with the code below? What I wanted is to pass two columns (sigma1 and sigma3) as parameters into a function and get the Slope and Y-Intercept. I am really confused about passing arrays into function. Thanks.
Function SLOPEPQ(sigma1 As Variant, sigma3 As Variant) As Long
Dim ctr As Integer
Dim PVALUE, QVALUE As Long
PVALUE = 0.5 * (sigma1 + sigma3)
QVALUE = 0.5 * (sigma1 - sigma3)
For ctr = LBound(arr1) To UBound(arr1)
PVALUE(ctr) = 0.5 * (sigma1(ctr) + sigma3(ctr))
QVALUE(ctr) = 0.5 * (sigma1(ctr) - sigma3(ctr))
Next ctr
SLOPEPQ = Application.LinEst(PVALUE, QVALUE)
End Function