반응형
Do ... Loop문을 이용한다.
Function MacExp(x)
Const Precision = 0.000000000000001
MacExp = 0
term = 1
k = 1
Do While Abs(term) > Precision
MacExp = MacExp + term
Debug.Print k; term; MacExp
term = term * x / k
k = k + 1
If k = 100 Then
MsgBox "Loop aborted, k > 100"
Exit Do
End If
Loop
End Function
반응형
'VBA' 카테고리의 다른 글
Atn함수를 이용하여 Pi계산하기 (0) | 2022.04.25 |
---|---|
셀 값에서 숫자만 없애는 방법 (0) | 2022.04.24 |
VBA에서 ":"의 사용법 (0) | 2022.04.19 |
Functions Visual Basic for Applications (0) | 2022.04.13 |
목표값찾기 단축 매크로 (0) | 2022.03.29 |