I have successfully implemented the appropriate =LINEST() formula for a polynomial regression on my spreadsheet, but when I try to implement the same calculation in VBA I can't figure out the correct syntax. Any help would be appreciated.
Formula on Sheet: =LINEST(M45:M59,J45:J59^{1,2},TRUE, TRUE)
Code in VBA: regressionVariables = WorksheetFunction.LinEst(yValues, xValues ^ Array(1, 2), True, True)
Arrays are included for type reference and this is not the order of code
ReDim xValues(1 To UBound(bondDataArray, 2)) As Variant
ReDim yValues(1 To UBound(bondDataArray, 2)) As Variant
Keep in mind that yValues and xValues are single dimension arrays and the error is a type mismatch error related to the LinEst function. I just can't find a good example of the correct syntax for a polynomial implementation, where straight line examples are all over.
Thanks.
Bookmarks