hi,
xp & w2k
excel 2k
I am faced with a challenge I can not seem to overcome.
the user enters or paste data in column b. then he/she clicks on the Start Button. that action moves the focus to the d column and the current time is entered. At this point, the cell d where the time has been entered should be locked so that it can not be modidied. at the same time the cell has moved to the e column on the same row. When the user clicks on the Stop button (the same button), the same action just described should take effect and lock the e cell. The actual time spend between the start and stop cells is recorded in the f column and that one too, should be locked. The user will do that a number of time during the day. the total procedure caluculates the time difference and adds that value to column f
here is the code for the start/stop button
Private Sub CommandButton1_Click()
If ActiveCell.Value = "" And CommandButton1.Caption = "Start" Then
CommandButton1.Caption = "Stop"
Range("d"& CStr(ActiveCell.Row)) = time
Range("e" & CStr(ActiveCell.Row)).Activate
StartTimer
ElseIf ActiveCell.Value = "" And CommandButton1.Caption = "Stop" Then
StopTimer
StopIt
CommandButton1.Caption = "Start"
ActiveCell.Value = Time
total
end if
End Sub
one buttons:
to start and then the code changes to stop the time.
--------
Start |
--------
b c d e f
__________________________________________________ _____
richard | |4:14:59 PM | 4:15:03PM| 0:00:02|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|
________|__________|___________|_________|________ _____|