Using Time in Excel

S

steven plummer

I have created a clocking-on style timesheet whereby you enter the time that you start work and time that you finish work and then it calculates how many hours:mins that you have worked and how much overtime has been done. It does work very well but my question is

Is it possible to create a macro that will enter the current time in a particular cell when a button is pressed?

In the spreadsheet that I have created a button like this would elimate human entry error and could end up been a real asset to companies who want to track the time that there employees work.

Thankyou



Submitted via EggHeadCafe - Software Developer Portal of Choice
..NET GDI+ - Convert BitMap To Jpeg
http://www.eggheadcafe.com/tutorial...accd-8291f3c89dfe/net-gdi--convert-bitma.aspx
 
P

Pete_UK

The key combination CTRL-SHIFT-semicolon (or CTRL-colon) inserts the
current time into a cell (followed by <enter>). Similarly, CTRL-
semicolon inserts the date, so if you wanted to insert both the date
and time into a cell you just need to do:

CTRL-semicolon
<space>
CTRL-SHIFT-semicolon
<enter>

Hope this helps.

Pete
 
G

Gord Dibben

Pete has given you a manual method which requires no macro.

You can use a macro if you choose but if you have no other use for VBA in
the workbook it may be better to keep the workbook code-free so's users
don't become apprehensive when they get the warning.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top