PDA

View Full Version : MS Excel, entering current Time into a cell.



John W
25-07-2002, 11:57 AM
Hello there.

Im having trouble enterig the current Time into a cell, and getting just that without the date as well.

Ive tried =Today()
Ive tried =Now()

=Time() doesnt eem to work

All come up with Date & Time.

This is for a Timecard Macro, to allow calculations of hours worked on a particular job for that day, but no spanned over several days.

Thanks in anticipation.....John.

parry
25-07-2002, 12:08 PM
Try =TEXT(NOW(),"hh:mm:ss")

Capt Jimbo
25-07-2002, 02:11 PM
If you want to write it into a macro you can use this

Sub Macro1()
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.NumberFormat = "h:mm:ss"
End Sub

Capt Jimbo

John W
25-07-2002, 08:39 PM
Thanks to all

I solved the problem, by formating the result in HH.mm, irrespective of Today or Time comand. Once this was done, the calculations went just fine.

Thanks again.......John.