title: Excel VBA For-Loop only runs in debug mode
body: <p>I am trying to figure out why the following code only works in debug mode...</p>
  
  <p>When I hit my "Save" button the macro saves every data entry even if it's the same company name. When I debug the macro goes into the for-loop and gives me the message "Company already exists". </p>
  
  <p>Where is my error?</p>
  
  <pre><code>Sub Copy_Values()
  
  Dim sapcolleague As String, str1 As String, str2 As String, str3 As String
  
  Dim i As Integer, ValueToFind As String, ValueToCheck As String
  Dim totalAccRows As Integer
  Dim accColumn As Integer
  Dim currentAccRow As Integer
  
  accColumn = 2
  totalAccRows = Worksheets("DB").Cells(Rows.Count, accColumn).End(xlUp).Row
  ValueToFind = Worksheets("Maintain").Range("F13").Value
  
  For currentAccRow = 2 To totalAccRows
      If Cells(currentAccRow, accColumn).Value = ValueToFind Then
          MsgBox ("Company already exists!")
          Exit Sub
      End If
  
  Next
  
  
  Worksheets("DB").Range("A8").EntireRow.Insert
  
  Worksheets("DB").Range("A8").Value = 
  Worksheets("Maintain").Range("F11").Value
  Worksheets("DB").Range("B8").Value = 
  Worksheets("Maintain").Range("F13").Value
  Worksheets("DB").Range("C8").Value = 
  Worksheets("Maintain").Range("F15").Value
  
  str1 = Worksheets("Maintain").Range("F18").Value
  str2 = Worksheets("Maintain").Range("F19").Value
  str3 = Worksheets("Maintain").Range("F20").Value
  
  sapcolleague = str1 &amp; " " &amp; str2 &amp; " " &amp; str3
  
  Worksheets("DB").Range("D8").Value = sapcolleague
  
  ' This MsgBox will only show if the loop completes with no success
  MsgBox "Successfully saved!"
  
  
  End Sub
  </code></pre>