title: Excel: How can I add code to a lost focus Event of a cell?
body: <p>Is there a way to add code to the <em>LostFocus</em> event of the cells in a sheet?</p>
  
  <p>I want to add code to keep the first 50 characters of the cell that loses the focus:</p>
  
  <pre><code>If Len(ActiveCell.FormulaR1C1) &gt; 50 Then
      ActiveCell.FormulaR1C1 = Left$(ActiveCell.FormulaR1C1, 47) + "..."
  End If
  </code></pre>