PDA

View Full Version : [SOLVED] How to display Elapsed time on a Excel User Form ( Using Excel 2007)



simora
08-13-2016, 08:58 PM
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

mikerickson
08-13-2016, 11:09 PM
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.

simora
08-14-2016, 01:25 AM
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 (http://www.vbaexpress.com/forum/member.php?10706-mikerickson) : Thanks.

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

It worked perfectly.