ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calculating Hours from Textbox Times (https://www.excelbanter.com/excel-programming/413628-calculating-hours-textbox-times.html)

Corey ....[_2_]

Calculating Hours from Textbox Times
 
Private Sub TextBox9_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox8 < "" And TextBox9 < "" Then Label63 = (TextBox9.Value -
TextBox8.Value) * 24
End Sub

With the above line of code, i am trying to gain the value in Hours between
the 2 textboxes, but i get an error.

Textbox8.value = 3:30PM
Textbox8.value = 7:30AM

??




Bob Phillips

Calculating Hours from Textbox Times
 
Private Sub TextBox9_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox8.Text < "" And TextBox9.Text < "" Then _
Label63.Caption = (TimeValue(TextBox9.Value) - _
TimeValue(TextBox8.Value)) * 24
End Sub



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Corey ...." wrote in message
...
Private Sub TextBox9_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox8 < "" And TextBox9 < "" Then Label63 = (TextBox9.Value -
TextBox8.Value) * 24
End Sub

With the above line of code, i am trying to gain the value in Hours
between the 2 textboxes, but i get an error.

Textbox8.value = 3:30PM
Textbox8.value = 7:30AM

??






Corey ....[_2_]

Calculating Hours from Textbox Times
 
Thank you BOB.

Perfect !!

"Bob Phillips" wrote in message
...
Private Sub TextBox9_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox8.Text < "" And TextBox9.Text < "" Then _
Label63.Caption = (TimeValue(TextBox9.Value) - _
TimeValue(TextBox8.Value)) * 24
End Sub



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Corey ...." wrote in message
...
Private Sub TextBox9_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox8 < "" And TextBox9 < "" Then Label63 = (TextBox9.Value -
TextBox8.Value) * 24
End Sub

With the above line of code, i am trying to gain the value in Hours
between the 2 textboxes, but i get an error.

Textbox8.value = 3:30PM
Textbox8.value = 7:30AM

??









All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com