I'm getting a type mismatch and I can't figure out for the life of m
why.
Code
-------------------
Dim CurveFitParams As Variant
Dim CurveFitA As Single 'Coefficient A of polynomial curve fit equation (Y = AX² + BX + C)
Dim CurveFitB As Single 'Coefficient A of polynomial curve fit equation (Y = AX² + BX + C)
Dim CurveFitC As Single 'Coefficient A of polynomial curve fit equation (Y = AX² + BX + C)
Dim MinRow As Long
Dim MaxRow As Long
CurveFitParams = Application.LinEst(Range("C" & MinRow & ":C" & MaxRow), Application.Power(Range("B" & MinRow & ":B" & MaxRow), Array(1, 2)), True, 0)
CurveFitA = Application.WorksheetFunction.Index(CurveFitParams, 1)
CurveFitB = Application.WorksheetFunction.Index(CurveFitParams, 2)
CurveFitC = Application.WorksheetFunction.Index(CurveFitParams, 3
-------------------
I'm getting a type mismatch on the LinEst line. I've been comparing i
to the code (and modifying it a bit successfully) you posted and can'
figure out what I'm doing different that's causing the problem. Fo
reference sake, below is your (working) code as I've modified it
Again, this works fine
Code
-------------------
Dim varr As Variant
Dim vara As Single
Dim varb As Single
Dim varc As Single
Dim MinRow As Long
Dim MaxRow As Long
MinRow = 2
MaxRow = 11
varr = Application.LinEst(Range("D" & MinRow & "

" & MaxRow), Application.Power(Range("A" & MinRow & ":A" & MaxRow), Array(1, 2)), True, 0)
vara = Application.Index(varr, 1)
varb = Application.Index(varr, 2)
varc = Application.Index(varr, 3)
Range("A25").Value = vara
Range("A26").Value = varb
Range("A27").Value = var