Created
December 19, 2012 14:02
-
-
Save descilla/4336873 to your computer and use it in GitHub Desktop.
Ein kurzes Script, welches errechnet, wann man Millionär ist.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub millionaer() | |
Dim start As String | |
Dim percent As String | |
Dim output | |
Do | |
If IsNumeric(start) And IsNumeric(percent) Then | |
If (percent * 1) > "10" Then | |
percent = "" | |
Else | |
' start*percent^n = 1000000 (Kürzen(durch start teilen)) | |
' percent^n = 1000000/start | |
' Log zur Basis x; n = Log(y)/Log(x) | |
output = Log(1000000 / start) / Log(1 + (percent / 100)) | |
MsgBox "In " & Round(output) & " Jahren sind Sie Millionär.", , "Millionär" | |
Exit Do | |
End If | |
ElseIf IsNumeric(start) Then | |
percent = InputBox("Bitte geben Sie einen Prozentwert (maximal 10%) ein", "Millionär", "3,5") | |
If percent = "" Then | |
Exit Do | |
End If | |
Else | |
start = InputBox("Bitte geben Sie einen Startbetrag ein", "Millionär", "1000") | |
End If | |
If start = "" Then | |
Exit Do | |
End If | |
Loop | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment