elapsed minutes

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
.
Barry was describing the format of the time ...

Are you now requesting code to make the time update in real time ? Or perhaps, calculating the difference between two times ?
 
Upvote 0
Yes that is right, both actually. Thank you very much.
 
Upvote 0
Just want to add this. I want to subtract 2:00am from 10:00pm

Starting time 10:00 pm
end time: 2:00 am

so total number of hours is 4. How can I subtract 2:00 am - 10:00 pm. Do I need to format the result cells as [hh]:mm first? It did not work? Thanks
 
Last edited:
Upvote 0
.
When you are working with times that go past midnight, the best approach (and easiest for me at least) is to include the date with the times. Excel then
can determine you are speaking of times spanning two days. You can format the cell where the answer will be displayed to show only the hours/minutes.

As for a timer, here is a basic project :

Code:
Option Explicit


Dim SchedRecalc As Date


Sub Recalc()


With Sheet1.Range("H3")


.Value = Format(Now, "mm/dd/yyyy - hh:mm:ss AM/PM")


End With


Call SetTime


End Sub


Sub SetTime()


SchedRecalc = Now() + TimeValue("00:00:01")


Application.OnTime SchedRecalc, "Recalc"


End Sub


Sub Disable()


On Error Resume Next


Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False


End Sub


Sub clr()


Disable


Sheet1.Range("H3").Value = " "


End Sub

Place a 3 commandbuttons on the worksheet. One titled START ... one titled STOP ... and one titled CLEAR.

Have the START button connected to the macro : SET TIME

Have the STOP button connected to the macro : DISABLE

Have the CLEAR button connected to the macro : CLR

The macro is coded to display the date/time in H3.
 
Upvote 0
That is a nice project. I will spend time to understand it. Thank you so much. I appreciate it.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top