View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Converting Time in a userform


TipTop

try:

Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
With Me.TextBox1
If Not IsDate(.Text) Then
Cancel = True
Beep
.SelStart = 0
.SelLength = Len(.Text)
Else
TextBox2.Text = Format(CDate(.Text), "HH:MM")
End If
End With
End Sub


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


tiptop wrote :

Quick Question, I have a userform, that in Textbox1 someone will
enter a time and I need it to return the time in Military time in
TextBox2. How can I set this up?

Ex.
When someone enters in Textbox1.text = 10:04 pm, I need it to convert
Textbox2.text = 22:04.

Any ideas?


---
Message posted from http://www.ExcelForum.com/