and here is the code for inserting the formulas for QMD and REL DENSITY (Note that the values for the variables myLastRow and CellValue have previously been defined):

'insert formulas for QMD

Range("K5").Select

ActiveCell.FormulaR1C1 = "=SQR(RC[-1]/RC[-2])/0.005454)"

'

'insert formulas for Relative Density

For Each Cell In Range("L5:L" & myLastRow)

CellValue = "=(R,C[-5]"

If CellValue = "Intermediate" Then

ActiveCell.FormulaR1C1 = "=(183.35/((R,C[-1])^2)*(-0.024257+(0.024257*(R,C[-1]))+(0.0015225*(R,C[-1])^2))*(R,C[-2])"

ElseIf CellValue = "Slow" Then

ActiveCell.FormulaR1C1 = "=(183.35/((R,C[-1])^2)*(-0.0027935+(0.0058959*((R,C[-1]))+(0.004729*K3^2))*((R,C[-2])"

ElseIf CellValue = "Fast" Then

ActiveCell.FormulaR1C1 = "=(183.35/((R,C[-1])^2)*(0.0033033+(0.020426*((R,C[-1]))+(0.0006776*((R,C[-1])^2))*((R,C[-2]))"

Else

ActiveCell.Formula = "=SUMIF(=SUMIF(RC[-7]:R[10000]C[-7],RC[-7],RC:R[10000]C)"

End If

Next

The Debug errors have happened on the SQR formula and the SUMIF formula.

Please help!

Thank you,

Kim