In diesem Beispiel wird mit Hilfe der Tabellenfunktion Pmt die Rückzahlung eines Hypothekendarlehens berechnet. Beachten Sie, dass dabei die InputBox-Methode anstatt der InputBox-Funktion verwendet wird, damit die Methode eine Typenüberprüfung durchführen kann. Auf Grund der Static-Anweisungen behält Visual Basic die Werte der drei Variablen bei; sie werden als Standardwerte angezeigt, wenn Sie das Beispiel erneut ausführen.
Static loanAmt Static loanInt Static loanTerm loanAmt = Application.InputBox _ (Prompt:="Loan amount (100,000 for example)", _ Default:=loanAmt, Type:=1) loanInt = Application.InputBox _ (Prompt:="Annual interest rate (8.75 for example)", _ Default:=loanInt, Type:=1) loanTerm = Application.InputBox _ (Prompt:="Term in years (30 for example)", _ Default:=loanTerm, Type:=1) payment = Application.Pmt(loanInt / 1200, loanTerm * 12, loanAmt) MsgBox "Monthly payment is " & Format(payment, "Currency")