Time format

war24

New Member
Joined
Oct 4, 2023
Messages
8
Office Version
  1. 2021
Platform
  1. Windows
  2. Web
Hello
Can you help me Guys about the calculation of two time
The start time and end time how I subtract it using a code in user form

Private sub Tb11_change()
Me.Tb11.value = timevalue(Tb10.value) - timevalue(tb9.value)
End sub
 
You can edit the code to display seconds as well:
VBA Code:
Private Sub Tb10_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Me.Tb11.Value = Format(TimeValue(Me.Tb10.Value) - TimeValue(Me.Tb9.Value), "hh:mm:ss")
End Sub

Have you tried the attachment in post 6, do the minutes display right there?
Yes i tried but nothings happen and also there is no Error on that
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You may have to download the attachment rather than use it in the online version of Excel.

On the attachment, try putting a time in the first two text box's and then press enter. What value do you get in the third box?
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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