Do Until Code

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Can anyone help with a piece of Code that will recalc the sheet until a
certain cell contains a certain value e.g.:-
A1 = 0

TIA
Peter
 
One way:

Do Until Range("A1").Value = 0
ActiveSheet.Calculate
Loop

Note that this is a dangerous piece of code since nothing internal to
the loop changes A1.

Also, rounding errors can sometimes make even proper loops fail. Better
might be:

Const epsilon As double = 1E-10
Do Until Abs(Range("A1").Value < epsilon
ActiveSheet.Calculate
Loop
 
You could use Goalseek or Solver unless A1 contains a function like a
countdown or something?
 
This routine will do:

Sub whatUneed()
Application.Calculation=xlCalculationManual
while cells(1,1)
Application.Calculate
Wend
End Sub
 
Back
Top