title: Default values for fields in a new row of a data table
body: <p>When you have a data table in Excel, part of the standard functionality is that pressing tab in the last cell adds a new row at the bottom of the table. I want to auto-populate that new row with useful default values. In particular I want to put current date-time in one cell, and copy values into some other cells from the previous row of the table.</p>
  
  <p>It is not workable to do that using formulae -- e.g. using <code>=now()</code> for the date-time stamp is inadequate because it will be auto-updated every time the spreadsheet recalculates, whereas I want it to retain the date-time at the moment when the row was added.</p>
  
  <p>So I am trying to write VBA to be triggered by the event of the row being added, and in that code to write values into the cells of the new row. From <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.tablenewrow.aspx" rel="noreferrer">MS documentation</a> I thought <code>DataTable.TableNewRow</code> would be the appropriate event. But when I try to write any code for that event it is not being executed. When I look up <code>DataTable</code> in the VBA object browser the <code>TableNewRow</code> event is not listed.</p>
  
  <p>Versions:</p>
  
  <ul>
  <li>VBA for Applications 7.1</li>
  <li>Excel 2013</li>
  </ul>
  
  <p>So my questions:</p>
  
  <ol>
  <li>Is the direction of my thinking right, or can you suggest a better approach?</li>
  <li>Can you offer any working code that does something like this?</li>
  <li>Is <code>DataTable.TableNewRow</code> the event I should be working with?</li>
  <li>What do I need to do to get that event accessible in my VBA code?</li>
  </ol>