回复 3楼 hanyao0923
是这个意思?
Private Sub Command1_Click()
Dim x As Single, y As Single, k As Single, i As Single, t As Single
x = 1
y = 2
k = 0.01
Do
i = i + 1: t = y - k * i
Loop Until Abs(t - x) < 0.1
MsgBox " i=" & i & Chr(10) & "abs(x-y)=" & t
End Sub