Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Time format for text box

I'm struggling abit here. I have the following formatting code for a couple
of textboxes. But it's not working. Any suggestions?

Private Sub UserForm_Initialize()
TextBox78 = Format(Sheets("summary").Range("N21"), "hh:mm")
TextBox79 = Format(Sheets("summary").Range("N22"), "hh:mm")
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Time format for text box

Hi,

That works fine but you have to have the time displayed in N21 and not just
formatted to show the date.

You can change the format of N21 & N22 at runtime if necessary to make it
display the time

Sheets("summary").Range("N21") = _
Format(Sheets("summary").Range("N21"), "hh:mm")

then your line

TextBox78.Text = Format(Sheets("summary").Range("N21"), "hh:mm")

Mike
"hoyos" wrote:

I'm struggling abit here. I have the following formatting code for a couple
of textboxes. But it's not working. Any suggestions?

Private Sub UserForm_Initialize()
TextBox78 = Format(Sheets("summary").Range("N21"), "hh:mm")
TextBox79 = Format(Sheets("summary").Range("N22"), "hh:mm")
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Time format for text box

Mike,
Thanks for replying. Do I put the first part of the formula in the sheet
code and the other in the textbox code?
Also the values in "hh:mm" are cumulative totals. It seems to go up to 24
hours and not beyond.

"Mike H" wrote:

Hi,

That works fine but you have to have the time displayed in N21 and not just
formatted to show the date.

You can change the format of N21 & N22 at runtime if necessary to make it
display the time

Sheets("summary").Range("N21") = _
Format(Sheets("summary").Range("N21"), "hh:mm")

then your line

TextBox78.Text = Format(Sheets("summary").Range("N21"), "hh:mm")

Mike
"hoyos" wrote:

I'm struggling abit here. I have the following formatting code for a couple
of textboxes. But it's not working. Any suggestions?

Private Sub UserForm_Initialize()
TextBox78 = Format(Sheets("summary").Range("N21"), "hh:mm")
TextBox79 = Format(Sheets("summary").Range("N22"), "hh:mm")
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Time format for text box

Try this
TextBox78.Value = Format(Sheets("summary").Range("N21"), "hh:mm")
TextBox79.Value = Format(Sheets("summary").Range("N22"), "hh:mm")

"hoyos" wrote:

I'm struggling abit here. I have the following formatting code for a couple
of textboxes. But it's not working. Any suggestions?

Private Sub UserForm_Initialize()
TextBox78 = Format(Sheets("summary").Range("N21"), "hh:mm")
TextBox79 = Format(Sheets("summary").Range("N22"), "hh:mm")
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Time format for text box

Mike,
I have managed to sort it out by:

Code in sheet "summary":

Range("n21").Value = Range("m21").Value
Range("n22").Value = Range("m22").Value

Code in userform:

TextBox79.Text = Sheets("summary").Range("N21").Text
TextBox78.Text = Sheets("summary").Range("N22").Text

Many thanks for your interest.


"Mike" wrote:

Try this
TextBox78.Value = Format(Sheets("summary").Range("N21"), "hh:mm")
TextBox79.Value = Format(Sheets("summary").Range("N22"), "hh:mm")

"hoyos" wrote:

I'm struggling abit here. I have the following formatting code for a couple
of textboxes. But it's not working. Any suggestions?

Private Sub UserForm_Initialize()
TextBox78 = Format(Sheets("summary").Range("N21"), "hh:mm")
TextBox79 = Format(Sheets("summary").Range("N22"), "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
Format Time as Text bpc Excel Worksheet Functions 9 September 15th 08 07:50 PM
How do I average time (in text format) Butterycolor Excel Discussion (Misc queries) 1 June 3rd 08 02:05 AM
change text format to time Hans Excel Worksheet Functions 3 October 18th 07 01:26 PM
How do I convert a time to text format. Rick Excel Discussion (Misc queries) 4 February 20th 06 11:02 PM
convert time imported as text to time format for calculations batfish Excel Worksheet Functions 3 October 27th 05 11:24 PM


All times are GMT +1. The time now is 02:03 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"