title: How to convert VBA Now() into seconds to determine total program runtime
body: <p>I'm working on a problem where I need to determine the total time my program takes to execute. First line of code needs to write the current "Start time" and last lines of code need to write the current "End time". Then I'm subtracting "Start time" - "End Time" = Total Time. </p>
  
  <p>I'm confused how I would use the FORMAT() function within VBA on the value of C2 to convert into seconds? Is there an other function that would work better than FORMAT? Basically I'm confused about Excel's Date Serial values and what they represent. </p>
  
  <p>Code is below</p>
  
  <p>EDIT: Thanks for the responses everyone. Both answers below work for what I'm trying to do. </p>
  
  <pre><code>sub ExecutionTime()
  
  Worksheets("Table").Range("A2").Value = Now()
  
  'All my executable code goes here. It's a relatively small program compiling a table so it
  runs very quick. 
  
  Worksheets("Table").Range("B2").Value = Now()
  Worksheets("Table").Range("C2").Value = Worksheets("Table").Range("A2").Value - Worksheets("Table").Range("B2").Value
  
  end Sub
  </code></pre>