title: VBA stops running when value is written in a cell
body: <p>I am organizing a dirty text in an organised table. And this code stops when the cell the marked line is completed. Can you help me to make it continuing the loop?</p>
  
  <pre><code>Private Sub CommandButton1_Click()    
      Dim sh As Worksheet
      Dim sh7 As Worksheet
  
      Dim CNAME As String
  
      Set sh = Worksheets("Sheet6")
      Set sh7 = Worksheets("Sheet7")    
      lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
  
      For n = 1 To lr
          If InStr(1, sh.Cells(n, 1), "CALL:") = 1 Then
              CNAME = sh.Cells(n, 7).Value    
              Ci = sh.Cells(n + 1, 7).Value    
              Cpd = sh.Cells(n + 1, 7).Value    
          Else
              If InStr(1, sh.Cells(n, 1), "Topic:") = 1 Then
                  T = sh.Cells(n, 2)
                  Tpd = sh.Cells(n + 1, 2)
                  Types = sh.Cells(n + 4, 2)
                  DM = sh.Cells(n + 5, 2)
                  D = sh.Cells(n + 5, 4)
                  OD = sh.Cells(n + 6, 2)
                  lr7 = sh7.Cells(Rows.Count, 1).End(xlUp).Row
                  sh7.Cells(lr7 + 1, 1).Value = CNAME '********This is the last line it runs.
                  sh7.Cells(lr7 + 1, 2).Value = Ci
                  sh7.Cells(lr7 + 1, 3).Value = Cpd
                  sh7.Cells(lr7 + 1, 4).Value = T
                  sh7.Cells(lr7 + 1, 5).Value = Tpd
                  sh7.Cells(lr7 + 1, 6).Value = Types
                  sh7.Cells(lr7 + 1, 7).Value = DM
                  sh7.Cells(lr7 + 1, 8).Value = D
                  sh7.Cells(lr7 + 1, 9).Value = OD
              End If  
          End If
      Next n
  End Sub
  </code></pre>