Vishwanath Korgaonkar
New Member
- Joined
- Sep 16, 2021
- Messages
- 15
- Office Version
- 365
- Platform
- Windows
I have an issue in calculating time difference. The code works fine for all of time expect on 2 occassion
1)when the end time come between 12:00 am to 12:55 am(midnight) it gives error as shown in figure.
2)At 24 hr interval .i.e for example start time 08:00 AM ,end time 08:00AM.It should show 24hrs
My code is as follows
combobox10=start time
combobox11=end time
textbox123=time difference
Private Sub ComboBox10_Change()
Me.ComboBox10.Value = Format(Me.ComboBox10.Value, "HH:MM AM/PM")
If Me.ComboBox10.ListIndex <> -1 And Me.ComboBox11.ListIndex <> -1 Then
Me.TextBox123.Value = WorksheetFunction.Text(TimeValue(Me.ComboBox11.Value) - TimeValue(Me.ComboBox10.Value) - (Me.ComboBox11.Value < Me.ComboBox10.Value), "h:mm")
End If
need your help
thank you in advance
1)when the end time come between 12:00 am to 12:55 am(midnight) it gives error as shown in figure.
2)At 24 hr interval .i.e for example start time 08:00 AM ,end time 08:00AM.It should show 24hrs
My code is as follows
combobox10=start time
combobox11=end time
textbox123=time difference
Private Sub ComboBox10_Change()
Me.ComboBox10.Value = Format(Me.ComboBox10.Value, "HH:MM AM/PM")
If Me.ComboBox10.ListIndex <> -1 And Me.ComboBox11.ListIndex <> -1 Then
Me.TextBox123.Value = WorksheetFunction.Text(TimeValue(Me.ComboBox11.Value) - TimeValue(Me.ComboBox10.Value) - (Me.ComboBox11.Value < Me.ComboBox10.Value), "h:mm")
End If
need your help
thank you in advance