Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a textbox on a userform for a military time (24 hour clock). The
trouble is that I can't seem to get any format codes to work. I just want the user to be able to input a 4 digit time and have the input display in the textbox as a 24 hour short time. For example: User inputs 1345 and then textbox displays 13:45. The value then postd to the spreadsheet would be 13:45. I know this is probably simple, but I can't seem to get anything to work. WillRn |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi WillRn
Something along the lines of Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hr = Int(Me.TextBox1 / 100) Min = Me.TextBox1 Mod 100 Sec = 0 Me.TextBox1 = Format(TimeSerial(Hr, Min, Sec), "hh:mm") Range("A1").Value = TimeSerial(Hr, Min, Sec) Range("a1").NumberFormat = "hh:mm" End sub Cheers JulieD "WillRn" wrote in message ... I have a textbox on a userform for a military time (24 hour clock). The trouble is that I can't seem to get any format codes to work. I just want the user to be able to input a 4 digit time and have the input display in the textbox as a 24 hour short time. For example: User inputs 1345 and then textbox displays 13:45. The value then postd to the spreadsheet would be 13:45. I know this is probably simple, but I can't seem to get anything to work. WillRn |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank You Julie! It was just what I needed.
Much Thanks, WillRn "JulieD" wrote: Hi WillRn Something along the lines of Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hr = Int(Me.TextBox1 / 100) Min = Me.TextBox1 Mod 100 Sec = 0 Me.TextBox1 = Format(TimeSerial(Hr, Min, Sec), "hh:mm") Range("A1").Value = TimeSerial(Hr, Min, Sec) Range("a1").NumberFormat = "hh:mm" End sub Cheers JulieD "WillRn" wrote in message ... I have a textbox on a userform for a military time (24 hour clock). The trouble is that I can't seem to get any format codes to work. I just want the user to be able to input a 4 digit time and have the input display in the textbox as a 24 hour short time. For example: User inputs 1345 and then textbox displays 13:45. The value then postd to the spreadsheet would be 13:45. I know this is probably simple, but I can't seem to get anything to work. WillRn |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you're welcome and thanks for the feedback
"WillRn" wrote in message ... Thank You Julie! It was just what I needed. Much Thanks, WillRn "JulieD" wrote: Hi WillRn Something along the lines of Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Hr = Int(Me.TextBox1 / 100) Min = Me.TextBox1 Mod 100 Sec = 0 Me.TextBox1 = Format(TimeSerial(Hr, Min, Sec), "hh:mm") Range("A1").Value = TimeSerial(Hr, Min, Sec) Range("a1").NumberFormat = "hh:mm" End sub Cheers JulieD "WillRn" wrote in message ... I have a textbox on a userform for a military time (24 hour clock). The trouble is that I can't seem to get any format codes to work. I just want the user to be able to input a 4 digit time and have the input display in the textbox as a 24 hour short time. For example: User inputs 1345 and then textbox displays 13:45. The value then postd to the spreadsheet would be 13:45. I know this is probably simple, but I can't seem to get anything to work. WillRn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Converting Standard Time to Military Time in Excel | Excel Discussion (Misc queries) | |||
Is there an XLS function to convert std time to Military time? | Excel Worksheet Functions | |||
Entering Military Time | Excel Worksheet Functions | |||
formula for converting military time to standard time, etc | Excel Discussion (Misc queries) | |||
Show timesheet time in and out in regular time versus military tim | Excel Worksheet Functions |