title: Why am I facing an overflow error only with the debugger?
body: <pre><code>Sub backsolve_straddle()
      Dim f_x As Double
      Dim dydx As Double
      Dim d1 As Double
      Dim d2 As Double
      Dim N_d1 As Double
      Dim N_d2 As Double
      Dim spot As Double
      Dim strike As Double
      Dim vol As Double
      Dim r As Double
      Dim tenor As Double
      Dim prem As Double
      Dim ea As Double
      Dim xr As Double
      Dim xi As Double
      Dim N_d1_neg As Double
      Dim N_d2_neg As Double
   
      spot = Worksheets(&quot;Straddle&quot;).Cells(3, 9)
      tenor = Worksheets(&quot;Straddle&quot;).Cells(5, 9)
      vol = Worksheets(&quot;Straddle&quot;).Cells(6, 9)
      r = Worksheets(&quot;Straddle&quot;).Cells(7, 9)
      prem = Worksheets(&quot;Straddle&quot;).Cells(8, 9)
      xi = Worksheets(&quot;Straddle&quot;).Cells(3, 11)
   
      ea = 100
      Do While ea &gt; 1
          d1 = (Application.WorksheetFunction.Ln(spot / xi) + (tenor * (r + (vol ^ 2 / 2)))) / (vol * (tenor ^ 0.5))
          d2 = d1 - (vol * (tenor ^ 0.5))
          N_d1 = Application.WorksheetFunction.Norm_S_Dist(d1, True)
          N_d2 = Application.WorksheetFunction.Norm_S_Dist(d2, True)
          N_d1_neg = Application.WorksheetFunction.Norm_S_Dist(-d1, True)
          N_d2_neg = Application.WorksheetFunction.Norm_S_Dist(-d2, True)
          
          f_x = spot * N_d1 - (xi * Exp(-r * tenor) * N_d2) + (xi * Exp(-r * tenor) * N_d2_neg) - (spot * N_d1_neg) - prem
          dydx = N_d1 - N_d1_neg
          
          xr = xi - (f_x / dydx)
          ea = Abs((xr - xi) / xr)
          xi = xr
      Loop
      Worksheets(&quot;Straddle&quot;).Cells(4, 9) = xr
   End Sub
  </code></pre>
  <p>I get the overflow error after the <code>Do While</code> line of code. Essentially, I'm using the debugger and when I enter the <code>Do While</code> loop, I get an overflow error. However, I don't get this error when I add a breakpoint at the end of the code and just skip to that point to the run the code. Can anyone guide me on why? I'm using Excel VBA on Mac if that makes a difference.</p>
  <p>Thanks in advance.</p>