Non VB user needs Excel help
Hello All;
First off I do not use VB but am willing to try and learn. The reason I choose to register and post here is you folks really seem to know your stuff.
So here is my question.
I am trying to find a way of timing work in MS Excel.
I want to be able to click a start timing button and a stop timing button on a job by job ( (row by row) basis and get the amount of time used up in a given cell.
Now here is the other part. I want to be able to time a work job (start and then stop) then go back to the same job hit start again and then stop again and have it add the new time to the previous time total so that the time is cumulative.
Can this be done???
Re: Non VB user needs Excel help
Welcome to the Forums mayakovski. :)
I take it that this is for a specific workbook and not all in general?
What version of Excel are you running? What happens if the user clicks somewhere else in Excel doing some work on that job and then reselects/click that job?
Re: Non VB user needs Excel help
When you start the timer you will need to record the cell that you are recording the timer in, the previous duration and the current timestamp.
When you stop the timer you will then need to update the correct cell with the previous duration + the time between now and when the timer was started.
VB Code:
Option Explicit
Dim MySheet As String
Dim MyColumn As Integer
Dim MyRow As Integer
Dim MyDuration As Double
Dim MyStart As Date
Sub Start_timer()
MySheet = ActiveSheet.Name
MyRow = ActiveCell.Row
MyColumn = 12 'Assuming this is the column where your storing the duration
MyDuration = Worksheets(MySheet).Cells(MyRow, MyColumn)
MyStart = Now()
End Sub
Sub Stop_timer()
Worksheets(MySheet).Cells(MyRow, MyColumn) = MyDuration + (Now() - MyStart)
End Sub
Re: Non VB user needs Excel help
This is for a specific workbook that I have setup to track projects at a help desk job. We are using Excel 2003. Ideally I would like it to manage multiple jobs at once, but I woulod be happy with one at a time.
Currently this is how it is setup.
Column A is start time using (Shift+CTRL+;)
Column B is end time using (Shift+CTRL+;)
Columns C, D, E are validation lists that drop down catagories of work sequentially.
Column F subtracts the end time from the start time and multiplies by 1440 and that gives me the minutes.
The problem is that I have to start a new row everytime I want to track a job, but that is not required by the company. I want to simply add time to the existing row with out having to manually calculte.
Does that make sense?
Re: Non VB user needs Excel help
Quote:
Originally Posted by mayakovski
I want to simply add time to the existing row with out having to manually calculte.
This is not possibe with your current structure of SartTime and EndTime columns.
Re: Non VB user needs Excel help
Quote:
This is not possibe with your current structure of SartTime and EndTime columns.
OK;
I am not attached to that layout, that is just waht I have right now. How do I change it to work?
Re: Non VB user needs Excel help
Why not contiune to add records to the existing table and calculation the duration for that specific task/piece of work.
Then you could just creat a PivotTable to sum the various individual entry durations to get a total duration for each project.
Re: Non VB user needs Excel help
Quote:
Why not contiune to add records to the existing table and calculation the duration for that specific task/piece of work.
Hmm, that would work though having a start and stop button that could continue from where it left off would be simpler to use, as I would not be recreating the job multiple times each day.
Re: Non VB user needs Excel help
Quote:
Originally Posted by mayakovski
....as I would not be recreating the job multiple times each day.
You don't need to recreate the job, just adding a new time block to that job.
You need to think of the JOB object and the TIMEBLOCK object as seperate.