Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time error on Userform Show DonF Excel Programming 2 November 23rd 05 09:56 PM
Format a Userform textbox to Military time Christy Excel Programming 2 August 24th 05 10:15 PM
TextBox in UserForm with 24h time format Mika Excel Programming 1 February 1st 05 07:45 PM
Format of textbox on userform and correct result Mark Excel Programming 1 July 13th 04 02:49 PM
SetFocus to first textbox on userform upon Userform1.Show Paul Simon[_3_] Excel Programming 6 February 11th 04 04:31 PM


All times are GMT +1. The time now is 09:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"