View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Enter current time into cell hh:mm:ss

Why not do it in one go?

Sub TimeStamp()
ActiveCell.Value = Format(Time,"h:mm:ss;@")
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"dominicb" wrote in
message ...

Good evening rglasunow

You would be better off using the =NOW() function, the only problem
with this is that it will alter every time the sheet is recalculated.
The code below will call the NOW() function, format the cell
appropriately and then changes the cell contents from a formula to a
value.

Sub TimeStamp()
ActiveCell.FormulaR1C1 = "=NOW()"
With Selection
NumberFormat = "h:mm:ss;@"
Formula = .Value
End With
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=382135