Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting Time in a userform

Quick Question, I have a userform, that in Textbox1 someone will ente
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 conver
Textbox2.text = 22:04.

Any ideas

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Converting Time in a userform

hi tiptop

i've just done this recently in i actually used three fields - one for hour
one for min & one for am/pm
(i actually put spin buttons & set min & max on the hour & min box too)
*******
If cboAM = "PM" Then
If txthrs = 12 Then
Else
txthrs = txthrs + 12
End If
Else
If txthrs = 12 Then
txthrs = 24
End If
End If

ftime = Format(txthrs, "00") & ":" & Format(txtmins, "00")
Range("A1").Value = ftime

*********

Cheers
JulieD



"tiptop " wrote in message
...
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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
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/


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
Converting Standard Time to Military Time in Excel mtvschultz Excel Discussion (Misc queries) 3 May 5th 23 11:42 AM
formula for converting military time to standard time, etc Pattio Excel Discussion (Misc queries) 8 February 17th 08 01:12 AM
Converting date/time serial values to cumulative time totals... Kevin B Excel Discussion (Misc queries) 4 October 18th 07 05:05 PM
Converting time formats into actual time(minutes) LeighM Excel Discussion (Misc queries) 2 October 30th 06 05:15 AM
Converting to UserForm Phil Hageman Excel Programming 1 October 16th 03 06:25 PM


All times are GMT +1. The time now is 02:59 AM.

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"