I'm working on a macro right now and it's producing weird results. The part that is specifically not working is a Min function.
a1RowTemp1 = a1Row For i = 0 To diff1 intercept = Application.WorksheetFunction.intercept(a(),c()) LinReg1 = (slope * Cells(a1RowTemp1, 1)) + intercept difference1 = Worksheets("GF9").Cells(a1RowTemp1, 2) - LinReg1 e(i) = difference1 a1RowTemp1 = a1RowTemp1 + 1 Next i a2RowTemp2 = a2Row For i = 0 To diff2 intercept2 = Application.WorksheetFunction.intercept(b(), d()) LinReg2 = (slope2 * Cells(a2RowTemp2, 1)) + intercept2 difference2 = Worksheets("GF9").Cells(a2RowTemp2, 2) - LinReg2 f(i) = difference2 a2RowTemp2 = a2RowTemp2 + 1 Next i Worksheets("Chart").Cells(currentRow, 12) = Application.Max(e()) Worksheets("Chart").Cells(currentRow, 13) = Application.Min(e()) Worksheets("Chart").Cells(currentRow, 25) = Application.Max(f()) Worksheets("Chart").Cells(currentRow, 26) = Application.Min(f()) In the bottom of the code it stores the difference1 and difference2 values in arrays e() and f(). When I use the functions max/min the macro only outputs the correct values for the max functions. I suspect this has something to do with my incorrectly using the arrays.