title: Goal seek exit year rises infinitely
body: <p>I am brand new to VBA.  I have a basic excel 2010 project finance model I made specifically for practicing goal seek macros and learning some VBA. I used this macro (taken from a workbook made by someone else) and successfully adapted it to my own to find the PPA rate by entering the desired IRR. </p>
  
  <p>However, I am trying to adapt it again to find the exit year by entering desired IRR, and it causes the exit year to increase infinitely.  Ideally I want it to only be able to seek for a year within a specified range and only round numbers (ie years 1-25 only)</p>
  
  <pre><code>Private Sub CommandButton2_Click()
  
  
  Equity_IRR_New = Range("D21").Value
  Equity_IRR_Old = Range("C23").Value
  Tariff_New = Worksheets("Sheet1").Range("C21").Value
  Tariff_Old = 0
  'Worksheets("Sheet1").Range("C21").Value = 100000'
  If (Equity_IRR_New &lt; Equity_IRR_Old) Then
      Do Until (Equity_IRR_New &gt;= Equity_IRR_Old)
          ExitYr_Old = Worksheets("Sheet1").Range("C21").Value
          ExitYr_New = ExitYr_Old * (0.999)
          Worksheets("Sheet1").Range("C21").Value = ExitYr_New
          Equity_IRR_Old = Range("C23").Value
      Loop
  End If
  
  If (Equity_IRR_New &gt; Equity_IRR_Old) Then
      Do Until (Equity_IRR_New &lt;= Equity_IRR_Old)
          ExitYr_Old = Worksheets("Sheet1").Range("C21").Value
          ExitYr_New = ExitYr_Old * (1.001)
          Worksheets("Sheet1").Range("C21").Value = ExitYr_New
          Equity_IRR_Old = Range("C23").Value
      Loop
  End If
  
  Range("C21").Value = ExitYr_New
  
  
  End Sub
  </code></pre>
  
  <p>Thank you in advance</p>