Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Format As TIME In A TextBox

Greetings,

I have a TextBox which is loaded with a date when a UserForm is
opened. I can't get the TextBox to display the entry in a TIME format
(hh:mm AM/PM).

Any help would be appreciated.

TIA

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Format As TIME In A TextBox

TextBox1.Text = Format$(Now, "hh:mm AM/PM")

HTH. Best wishes Harald

"Minitman" skrev i melding
...
Greetings,

I have a TextBox which is loaded with a date when a UserForm is
opened. I can't get the TextBox to display the entry in a TIME format
(hh:mm AM/PM).

Any help would be appreciated.

TIA

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Format As TIME In A TextBox

Hey Harold,

Thanks for the reply. This works for current time entries. However,
I am entering times figures other then current time.

Is there a variant that will allow any time to be entered?

-Minitman



On Tue, 8 Feb 2005 22:52:13 +0100, "Harald Staff"
wrote:

TextBox1.Text = Format$(Now, "hh:mm AM/PM")

HTH. Best wishes Harald

"Minitman" skrev i melding
.. .
Greetings,

I have a TextBox which is loaded with a date when a UserForm is
opened. I can't get the TextBox to display the entry in a TIME format
(hh:mm AM/PM).

Any help would be appreciated.

TIA

-Minitman



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Format As TIME In A TextBox

I thought you had a display problem, sorry. To turn text into a time
variable, use Timevalue:

Dim T As Date
On Error Resume Next
T = TimeValue(TextBox1.Text)
If Err.Number = 0 Then
MsgBox Format$(T, "hh:mm:ss")
Else
MsgBox "No time for losers"
End If

HTH. Best wishes Harald


"Minitman" skrev i melding
...
Hey Harold,

Thanks for the reply. This works for current time entries. However,
I am entering times figures other then current time.

Is there a variant that will allow any time to be entered?

-Minitman



On Tue, 8 Feb 2005 22:52:13 +0100, "Harald Staff"
wrote:

TextBox1.Text = Format$(Now, "hh:mm AM/PM")

HTH. Best wishes Harald

"Minitman" skrev i melding
.. .
Greetings,

I have a TextBox which is loaded with a date when a UserForm is
opened. I can't get the TextBox to display the entry in a TIME format
(hh:mm AM/PM).

Any help would be appreciated.

TIA

-Minitman





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Format As TIME In A TextBox

Hey Harald,

It is a display problem. The first example:

TextBox1.Text = Format$(Now, "hh:mm AM/PM")

Modified like this (The named range on the worksheet is "CallTime"):

TextBox1.Text = Format$(Range("CallTime").Text, "hh:mm AM/PM")

That is what I was trying to remember.

Thanks.

-Minitman

On Tue, 8 Feb 2005 23:26:31 +0100, "Harald Staff"
wrote:

I thought you had a display problem, sorry. To turn text into a time
variable, use Timevalue:

Dim T As Date
On Error Resume Next
T = TimeValue(TextBox1.Text)
If Err.Number = 0 Then
MsgBox Format$(T, "hh:mm:ss")
Else
MsgBox "No time for losers"
End If

HTH. Best wishes Harald


"Minitman" skrev i melding
.. .
Hey Harold,

Thanks for the reply. This works for current time entries. However,
I am entering times figures other then current time.

Is there a variant that will allow any time to be entered?

-Minitman



On Tue, 8 Feb 2005 22:52:13 +0100, "Harald Staff"
wrote:

TextBox1.Text = Format$(Now, "hh:mm AM/PM")

HTH. Best wishes Harald

"Minitman" skrev i melding
.. .
Greetings,

I have a TextBox which is loaded with a date when a UserForm is
opened. I can't get the TextBox to display the entry in a TIME format
(hh:mm AM/PM).

Any help would be appreciated.

TIA

-Minitman






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
TextBox format? Pas Excel Discussion (Misc queries) 5 April 25th 10 11:13 PM
TextBox format? AOU Excel Discussion (Misc queries) 4 June 12th 07 11:24 PM
format textbox to time ASU Excel Discussion (Misc queries) 3 June 7th 06 10:05 PM
TextBox Format grahammal Excel Discussion (Misc queries) 3 March 29th 06 01:35 PM
TextBox in UserForm with 24h time format Mika Excel Programming 1 February 1st 05 07:45 PM


All times are GMT +1. The time now is 03:27 PM.

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

About Us

"It's about Microsoft Excel"