Macro

M

muddan madhu

Hi,

I need time sheet macro.
Suppose one user starts his work @ 8 ,

Here is what I need ( Step by step)
1. before user starts working need to click the button, in just single
click on the button
time will be appeared in A10 cell. (e.g., 06:16:00 AM)

2. Once the user completes the work and then user click's the button
in B10 end time
will be showed (E.g., 06:20:00 AM)

3. Start and end time difference need to appear on A9 cell.

Can u please input solution.
 
F

FloMM2

muddan madhu,
This is what I came up with for you to try:
Format the cells (A9, A10, &B10) with the Format, Cell, Time with the proper
format.
Put a Command button on the worksheet, Command1
Place a second Command button on the worksheet, Command2
On the worksheet select "Design Mode" icon.
Select the first button, right click, select "Properties"
On the "Alphabetic" tab, change the CAPTION entry from CommandButton1 to
"START". Change the PrintObject entry to "False" so the button will not print.

Select the first button again, right click, select "View Code"
Underneath the line "Private Sub CommandButton1_Click() type:

"Range("A10").Select
ActiveCell.FormulaR1C1 = Now()" without the ""

Select the second button, right click, select "Properties"
On the "Alphabetic" tab, change the CAPTION entry from CommandButton2 to
"END". Change the PrintObject entry to "False" so the button will not print.

Select the second button again, right click, select "View Code"
Underneath the line "Private Sub CommandButton2_Click() type:

"Range("B10").Select
ActiveCell.FormulaR1C1 = Now()


Range("A9").Select
ActiveCell.FormulaR1C1 = Range("B10") - Range("A10")
Range("A9").Select
ActiveCell.NumberFormat = "h:mm:ss""
Leaving off the first " and the last ".
hth
 

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