Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
textbox show correct time in userform
Hi,
I'm having problems with a textbox that I created in my userform. The problem is I have the textbox set to display time ("hh:mm") in the 24 hour mode. Each time the user enters the correct time the textbox will take the time, but when it re-opens it displays the time as numbers not time. Once I click in and out of the textbox it reverts to the correct time. I want the textbox to display the entered time when the userform is opened. How can I force my textbox to display time? My VBA code is as follows: Private Sub TimeTextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) TimeTextBox1.Value = Format(TimeTextBox1.Value, "hh:mm") End Sub Thanks for your assistance in advance, Titus |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
textbox show correct time in userform
I'm having problems with a textbox that I created in my userform. The
problem is I have the textbox set to display time ("hh:mm") in the 24 hour mode. Each time the user enters the correct time the textbox will take the time, but when it re-opens it displays the time as numbers not time. Once I click in and out of the textbox it reverts to the correct time. I want the textbox to display the entered time when the userform is opened. How can I force my textbox to display time? My VBA code is as follows: Private Sub TimeTextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) TimeTextBox1.Value = Format(TimeTextBox1.Value, "hh:mm") End Sub Put your code inside the following sub too: Private Sub UserForm_Activate() TimeTextBox1.Value = Format(TimeTextBox1.Value, "hh:mm") End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run time error on Userform Show | Excel Programming | |||
Format a Userform textbox to Military time | Excel Programming | |||
TextBox in UserForm with 24h time format | Excel Programming | |||
Format of textbox on userform and correct result | Excel Programming | |||
SetFocus to first textbox on userform upon Userform1.Show | Excel Programming |