Thanks for the response...
I have noticed many examples using the WorsheetFunction.Transpose() function which looks to correct the issue you are referring to, but none of the examples actual compile for me. I keep getting a type mismatch error.
I chose to just build the formula as a string and pass my it through to the evaluate function in Excel and go on down the road. Maybe someone else will find the correct implementation, but I will post my workaround for those out there in the same situation.
Public Sub BuildYieldRegressionFunction(bondDataArray As Variant, outputRangeAddress As String)
Dim regressionVariables As Variant
ReDim xValues(1 To UBound(bondDataArray, 2)) As Variant
ReDim yValues(1 To UBound(bondDataArray, 2)) As Variant
Dim coefficents As Variant
Dim iCnt As Integer
Dim rowCnt As Integer
Dim colCnt As Integer
xValues = StripSingleDimensionArray(bondDataArray, COL_ID_TIME_UNTIL_MATURITY)
yValues = StripSingleDimensionArray(bondDataArray, COL_ID_YTM_TRACE_250K)
ActiveWorkbook.Names.Add Name:="xValues", RefersTo:=Range(Cells(1000, 50), Cells(1000 + UBound(xValues) - 1, 50))
For iCnt = 1 To UBound(xValues)
Range("xValues").Cells(iCnt) = xValues(iCnt)
Next
ActiveWorkbook.Names.Add Name:="yValues", RefersTo:=Range(Cells(1000, 51), Cells(1000 + UBound(yValues) - 1, 51))
For iCnt = 1 To UBound(yValues)
Range("yValues").Cells(iCnt) = yValues(iCnt)
Next
coefficents = Evaluate("LINEST(" & Range("xValues").Address & "," & Range("yValues").Address & "^{1,2},TRUE, TRUE)")
Range("xValues").Clear
Range("yValues").Clear
ActiveWorkbook.Names.Item("xValues").Delete
ActiveWorkbook.Names.Item("yValues").Delete
Range(outputRangeAddress).ClearContents
For rowCnt = 1 To UBound(coefficents, 1)
For colCnt = 1 To UBound(coefficents, 2)
Range(outputRangeAddress).Cells(rowCnt, colCnt) = coefficents(rowCnt, colCnt)
Next
Next
End Sub
Bookmarks