ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro (https://www.excelbanter.com/excel-discussion-misc-queries/184911-macro.html)

muddan madhu

Macro
 
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.


FloMM2

Macro
 

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

"muddan madhu" wrote:

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.




All times are GMT +1. The time now is 10:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com