當觸發條件時跳出for循環?
不一定每次都有結果,得多次運行Sub cc() Dim e1, e2, a, i a = 0.5 e1 = Rnd e2 = Rnd * -1 For i = 1 To 10 a = e1 * 1 + e2 + a If a < 0 Then MsgBox a Exit Sub End If Next i MsgBox "未找到結果"End Sub
當觸發條件時跳出for循環?
不一定每次都有結果,得多次運行Sub cc() Dim e1, e2, a, i a = 0.5 e1 = Rnd e2 = Rnd * -1 For i = 1 To 10 a = e1 * 1 + e2 + a If a < 0 Then MsgBox a Exit Sub End If Next i MsgBox "未找到結果"End Sub