Consulting

Results 1 to 3 of 3

Thread: How to display Elapsed time on a Excel User Form ( Using Excel 2007)

  1. #1
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location

    How to display Elapsed time on a Excel User Form ( Using Excel 2007)

    On a worksheet, I have 2 cells which display times; Start time & Current time
    I have another cell , J4 which displays the correct Elapsed time. Like 0:02:19
    How can I take that cell value and display it correctly in a UserForm Caption.
    I Tried various formatting options. None of which worked.
    Eg.


    Me.Label5.Caption = Format(Time, "hh:mm:ss")
    
      Me.Label5.Caption = Sheets("SheetSales").Range("J5").Value

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Try
    Me.Label15.Caption = Format(Sheets("SheetSales").Range("J4").Value, "hh:mm:ss")
    I note that your description puts the elapsed time in J4, while your code referred to J5.
    I am also assuming that the Start and Currnent cells hold excel serial time and J4 has a simple subtraction formula, i.e. there is not a text value in J4.

  3. #3
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    Quote Originally Posted by mikerickson View Post
    Try
    Me.Label15.Caption = Format(Sheets("SheetSales").Range("J4").Value, "hh:mm:ss")
    I note that your description puts the elapsed time in J4, while your code referred to J5.
    I am also assuming that the Start and Currnent cells hold excel serial time and J4 has a simple subtraction formula, i.e. there is not a text value in J4.

    mikerickson : Thanks.

    Cell J4 did indeed have the Time value that I needed.

    It worked perfectly.

Posting Permissions

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