Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format a Userform textbox to Military time
I have a user form with 5 textboxes linked to cells. I can't seem to get the
textboxes to show the entry in Military time. It keeps changing to decimal. The time shows up correctly in the cell. any help would be greatly appreciated. Christy ;) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format a Userform textbox to Military time
Try something like:
Private Sub UserForm_Initialize() Dim ws As Worksheet Set ws = ActiveSheet TextBox1.Text = Format$(ws.Range("A1"), "H:mm") Set ws = Nothing End Sub Note: the capital 'H' in the format string is important. If you use a lowercase 'h' then you'll get a 12-hour clock value. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format a Userform textbox to Military time
Thanks Nick, I will try that!
Christy ;) "Nick Hebb" wrote: Try something like: Private Sub UserForm_Initialize() Dim ws As Worksheet Set ws = ActiveSheet TextBox1.Text = Format$(ws.Range("A1"), "H:mm") Set ws = Nothing End Sub Note: the capital 'H' in the format string is important. If you use a lowercase 'h' then you'll get a 12-hour clock value. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
military format of time | Excel Discussion (Misc queries) | |||
i want to use military format for time e.g. 07:00 as 0700 | Excel Worksheet Functions | |||
getting military time format within excel | Excel Discussion (Misc queries) | |||
Entering military time into a userform | Excel Programming | |||
TextBox in UserForm with 24h time format | Excel Programming |