I think the reason this will not work is the variables for the Do Loop are changing inside the Loop itself and Excel does not like that.
Is there any other Loops that may work in this case?
Code
E1 = Pi / 4 'Initialize
diff = 1 'Initialize
Do While Math.Abs(diff) > 0.00001
diff = (E1 - e(k) * Math.Sin(E1) - MA(k) * Pi / 180) / (1 + Math.Cos(E1))
E1 = E1 + diff
Loop
Tried
Code
Do Until Math.Abs(diff) < 0.00001
diff = (E1 - e(k) * Math.Sin(E1) - MA(k) * Pi / 180) / (1 + Math.Cos(E1))
E1 = E1 + diff
Loop
Code
Do
diff = (E1 - e(k) * Math.Sin(E1) - MA(k) * Pi / 180) / (1 + Math.Cos(E1))
E1 = E1 + diff
Loop While Math.Abs(diff) > 0.00001
A For or a ForEach will not work in this case.