I'm trying to run a Jensen's Regression and my code is not working. The debugger says my offcol = UBound(result, 1) is a type mismatch. Below is the code I have wrote. Any help would be great. Sub regCAPM(xrange, yrange) 'jensen regression Dim result Dim pval As Single, tstat As Single, alpha As Single Dim offcol As Integer, offst As Integer result = Application.LinEst(Range(yrange).Value, Range(xrange).Value, 1, 1) offcol = UBound(result, 2) 'why??????????? If offcol = 2 Then offst = 0 ElseIf offcol = 4 Then offst = 1 Else offst = 2 End If
Solved by E. U. in 28 mins