sumit dey
07-02-2015, 09:27 PM
Hello Everyone,
I have created a small MIS for my team which have a start Time and End Time Buttons to capture productive Time.
After I click the Start Time Button start time gets capture in the defined range of cells and Endtime Button Gets active to capture end time when clicked. But, if I close the Workbook without clicking the End Time Button and re open the workbook the End Time button gets Inactive and I have to click the Start Button once again and therefore inaccurate data gets captured.
I am using the below code:
in Sheet1
Const ms PASSWORD as String ="ThePassword"
Private Sub btnStart_Click()
Sheet1.Unprotect Password:= ms PASSWORD
Cells(Rows.Count, 4).End(xlup).Offset(1)=Date
Cells(Rows.Count, 4).End(xlup).NumberFormat="dd mmm yyyy"
Cells(Rows.Count, 8).End(xlup).Offset(1)=Now
Cells(Rows.Count, 8).End(xlup).NumberFormat="hh:mm"
Cells(Rows.Count, 3).End(xlup).Offset(1) = Environ("username")
Me.btnStart=False
Me.btnStop=True
Sheet1.Protect Password:=msPASSWORD
End Sub
Private Sub btnStop_Click()
Sheet1.Unprotect Password:=msPASSWORD
Cells(Rows.Count, 9).End(xlup).Offset(1)=Now
Cells(Rows.Count, 9).End(xlup).NumberFormat="hh:mm"
Me.btnStart=True
Me.btnStop=false
Sheet1.Protect Password:=msPASSWORD
End Sub
In ThisWorkBook:
Private Sub WorkBook_Open()
Sheets(1).btnStart.Enabled=True
Sheets(1).btnStop.Enabled=false
End Sub
I want the end time button to remain active inspite of the workbook is closed till it's clicked...
One more thing, is there a way wherein I just click the Start button once and whenever I click the End time button it capture the end time as well as the next start time in respective cells so, that I just required to click a single button (End Time Button) each time to record my productive hours...
thanks in advance everyone...
I have created a small MIS for my team which have a start Time and End Time Buttons to capture productive Time.
After I click the Start Time Button start time gets capture in the defined range of cells and Endtime Button Gets active to capture end time when clicked. But, if I close the Workbook without clicking the End Time Button and re open the workbook the End Time button gets Inactive and I have to click the Start Button once again and therefore inaccurate data gets captured.
I am using the below code:
in Sheet1
Const ms PASSWORD as String ="ThePassword"
Private Sub btnStart_Click()
Sheet1.Unprotect Password:= ms PASSWORD
Cells(Rows.Count, 4).End(xlup).Offset(1)=Date
Cells(Rows.Count, 4).End(xlup).NumberFormat="dd mmm yyyy"
Cells(Rows.Count, 8).End(xlup).Offset(1)=Now
Cells(Rows.Count, 8).End(xlup).NumberFormat="hh:mm"
Cells(Rows.Count, 3).End(xlup).Offset(1) = Environ("username")
Me.btnStart=False
Me.btnStop=True
Sheet1.Protect Password:=msPASSWORD
End Sub
Private Sub btnStop_Click()
Sheet1.Unprotect Password:=msPASSWORD
Cells(Rows.Count, 9).End(xlup).Offset(1)=Now
Cells(Rows.Count, 9).End(xlup).NumberFormat="hh:mm"
Me.btnStart=True
Me.btnStop=false
Sheet1.Protect Password:=msPASSWORD
End Sub
In ThisWorkBook:
Private Sub WorkBook_Open()
Sheets(1).btnStart.Enabled=True
Sheets(1).btnStop.Enabled=false
End Sub
I want the end time button to remain active inspite of the workbook is closed till it's clicked...
One more thing, is there a way wherein I just click the Start button once and whenever I click the End time button it capture the end time as well as the next start time in respective cells so, that I just required to click a single button (End Time Button) each time to record my productive hours...
thanks in advance everyone...