Results 1 to 9 of 9

Thread: Non VB user needs Excel help

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    4

    Exclamation 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???

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    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:
    1. Option Explicit
    2.  
    3. Dim MySheet As String
    4. Dim MyColumn As Integer
    5. Dim MyRow As Integer
    6. Dim MyDuration As Double
    7. Dim MyStart As Date
    8.  
    9. Sub Start_timer()
    10.    
    11.     MySheet = ActiveSheet.Name
    12.     MyRow = ActiveCell.Row
    13.     MyColumn = 12 'Assuming this is the column where your storing the duration
    14.     MyDuration = Worksheets(MySheet).Cells(MyRow, MyColumn)
    15.     MyStart = Now()
    16.    
    17. End Sub
    18.  
    19.  
    20. Sub Stop_timer()
    21.    
    22.     Worksheets(MySheet).Cells(MyRow, MyColumn) = MyDuration + (Now() - MyStart)
    23.    
    24. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    4

    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?

  5. #5
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

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

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    4

    Re: Non VB user needs Excel help

    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?

  7. #7
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

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

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2005
    Posts
    4

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

  9. #9
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

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

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width