General discussion

Locked

Time problem in Excel

By dprtech ·
Im trying to create a "clocking in" program for staff in Excel. I've had no problem creating the basic structure which allows the user to check box next to their name which then enters the system time. However, i'm not sure how to make the time "absolute". It's still dynamic after its been entered. I know that i can double cllick on the time then press F9 and this seems to do the trick - but i can't expect users to have to do this every time they "clock in". Have had no luck with macro either. Does anyone have any ideas?
Thanks

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Time problem in Excel

by Larry H. In reply to Time problem in Excel

Try the following macro. You might want to use a different time format, but this should do what you want.

Sub TimeMacro()
'
' TimeMacro Macro
' Macro to place current date and time in a
' cell and format as time.
'
Dim dblTime As Double dblTime = Now
ActiveCell.FormulaR1C1 = dblTime
Selection.NumberFormat = "h:mm AM/PM"
End Sub

Collapse -

Time problem in Excel

by dprtech In reply to Time problem in Excel

Poster rated this answer

Collapse -

Time problem in Excel

by pVp In reply to Time problem in Excel

I don't play with VBA and/or macros, but manually, you'd want to Copy, then "Paste Special...Values" for the cell just modified.

That way the cell will no longer contain a formula to be updated, but will contain the time value.

Collapse -

Time problem in Excel

by dprtech In reply to Time problem in Excel

Poster rated this answer

Collapse -

Time problem in Excel

by srobertson In reply to Time problem in Excel

Try using,

'Activecell.Value = Format(Now,"HH:NN:SS")'

This will place the current TimeValue into the Activecell. Change the formating to suit yourself remebering that in VBA "MM" refers to the Month not Minutes hence the "NN".

Scott.

Collapse -

Time problem in Excel

by dprtech In reply to Time problem in Excel

thanx scott - tried this and worked great

Collapse -

Time problem in Excel

by dprtech In reply to Time problem in Excel

This question was closed by the author

Back to Windows Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums