View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Need help building a macro that displays date/time in active cell

Here is a macro to do what you asked for...

Sub InsertDateTime()
ActiveCell.Value = Now
ActiveCell.NumberFormat = "mmm d, yyyy - h:mm:ss AM/PM"
End Sub

Note that unlike the worksheet function NOW(), the date/time entered into
the active cell by this code will be fixed at the date and time the code was
executed.

--
Rick (MVP - Excel)


"MSUser" wrote in message
...