title: VBA: code stops executing when writing to cell
body: <p>I have been experiencing an issue with VBA in Excel, where the Sub below will suddenly stop executing at the lines indicated.</p>
  
  <p>The purpose of the sub is to update  two cells whenever the "ckbRequestNeu" checkbox on the worksheet is pressed. However, when stepping through, the code only ever gets as far as writing a single value to the worksheet. E.g. if Inp_Exists = 1 then it will write Inp_Exists = 2, but will then immediately stop as if an End statement had executed.</p>
  
  <p>If I then press F8 to continue stepping, the sub restarts as if the checkbox has been clicked again. This seems as if the ckbRequestNEU_Click event has been triggered again, but I've got no idea how this is happening.</p>
  
  <pre><code>Private Sub ckbRequestNEU_click()
  
      With Worksheets("Stress Requests")
  
          'If an input file exists, mark it as out of date
          If .Range("InpExists").Value = 1 Then
              .Range("InpExists").Value = 2  'Code stops here
          End If
  
          If .ckbRequestNEU = False Then
              .Range("Request_NEU") = 0   'And here
              .ckbRequestNEU.BackColor = RGB(179, 255, 179)
          Else
              .Range("Request_NEU") = 1   'Or here
              Sheets("Stress Requests").Cells(33, 5) = 1
              .ckbRequestNEU.BackColor = RGB(0, 204, 0)
          End If
  
      End With
  
  End Sub
  </code></pre>
  
  <p>The program overall is to create an text input file for a finite element solver, and so the first If statement checks whether the file exists and marks it as out of date, based on the fact the checkbox (one of the parameters for the file) has changed.</p>