Excel VBA run-time error 1004: Application-defined or object-defined error
<p>very novice user, having some difficulty getting this code up and running. I am attempting to calculate a value based on some other cells and iterating to minimize error. When running, I get the aforementioned error on the Cells(i, 17) = Cells(i, 5) line. Thoughts? Thank you.</p>

<pre><code>Private Sub CommandButton1_Click()
Dim i As Long
A = 6.112
B = 17.67
C = 243.5
epsilon = 0.622
G = B * C
maxerror = 0.001
For i = 2 To Rows.Count
Next i
iter = 0
Cells(i, 17) = Cells(i, 5)

    Do While iter &lt; 50
        iter = iter + 1
        bt = B * Cells(i, 17)
        tpc = Cells(i, 17) + C
        d = (Cells(i, 9) / A) * Exp(-bt / tpc)
        dm1 = d - 1#
        f = (Cells(i, 5) - Cells(i, 17)) - Cells(i, 16) * (epsilon / dm1 - Cells(i, 13))
        df = -G / (tpc * tpc)
        df = d * df * Cells(i, 16) * epsilon / (dm1 * dm1) - 1#
        cor = f / df
        Cells(i, 17) = Cells(i, 5) - cor
        If Abs(cor) &lt; maxerror Then
            Exit Do
        End If
    Loop


End Sub
</code></pre>