Hoping someone can help me give goalseek a margin of error in VBA.

I created a spreadsheet that calculates how much you would pay on a loan if you are also getting a return (rent) on your investment.

My workbook has a couple of spreadsheets that use an amortization table, currency conversions (investment in another country), etc.

I added a vba button with goalseek that would tell me what is the maximum downpayment I can put in after all other variables are set (years, interest rate, rent, etc.) so that my loan payments are equal to my rent.

Because there are so many calculations going on the function sometimes works but most of the times it goes haywire. Because I don't need a very precise level of accuracy I think I can fix the issue by giving the goalseek a margin of error of +-1 or even +-5.

Cell O1 is equal to Rent - Loan Payment.

Goal is O1 = 0.

By changing Cell E2 which is equal to Downpayment.

This is my code:

VBA Code:

```
Private Sub GoalSeek_Click()
Range("O1").GoalSeek _
Goal:=0, _
ChangingCell:=Range("E2")
End Sub
```

Thanks!!