Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Userform Defaults Text Box with Time

I'm using a userform for data entry purposes and it is set to call the
values currently in the cells to display in the text boxes. Example:
TextBox1 relates to the cell in row 2 column 4

Private Sub UserForm_Activate()
Me.Time.Text = Worksheets("Data").Cells(2, 4).Value
End Sub

My problem is that the value in row 2 column 4 is a time and on the
form it displays a decimal value

is there a way to make my text box display this number as a time
instead?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Userform Defaults Text Box with Time

I forgot to mention that it will not always be a time (sometimes it
will be text explaining why the event didn't happen rather than the
time it did happen)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Userform Defaults Text Box with Time

Format is good, but "dd/mm/yyyy" gives me it as days and not times

whats the format for times? 12 hour clock including AM/PM

Ardus Petus wrote:
Try:
Me.Time.Text = Format(Worksheets("Data").Cells(2, 4).Value,"dd/mm/yyyy")

HTH
--
AP


"Matt" a écrit dans le message de news:
...
I'm using a userform for data entry purposes and it is set to call the
values currently in the cells to display in the text boxes. Example:
TextBox1 relates to the cell in row 2 column 4

Private Sub UserForm_Activate()
Me.Time.Text = Worksheets("Data").Cells(2, 4).Value
End Sub

My problem is that the value in row 2 column 4 is a time and on the
form it displays a decimal value

is there a way to make my text box display this number as a time
instead?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Userform Defaults Text Box with Time

Try this:

Private Sub UserForm_Activate()
Me.Time.Text = Worksheets("Data").Cells(2, 4).Text
End Sub

Matt wrote:
I'm using a userform for data entry purposes and it is set to call the
values currently in the cells to display in the text boxes. Example:
TextBox1 relates to the cell in row 2 column 4

Private Sub UserForm_Activate()
Me.Time.Text = Worksheets("Data").Cells(2, 4).Value
End Sub

My problem is that the value in row 2 column 4 is a time and on the
form it displays a decimal value

is there a way to make my text box display this number as a time
instead?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Userform Defaults Text Box with Time

That works, thanks!

Also found:

Private Sub UserForm_Activate()
Me.Time.Text = Format(Worksheets("Data").Cells(2, 4).Value, "h:mm
AM/PM")
End Sub

both work

Mark Lincoln wrote:
Try this:

Private Sub UserForm_Activate()
Me.Time.Text = Worksheets("Data").Cells(2, 4).Text
End Sub

Matt wrote:
I'm using a userform for data entry purposes and it is set to call the
values currently in the cells to display in the text boxes. Example:
TextBox1 relates to the cell in row 2 column 4

Private Sub UserForm_Activate()
Me.Time.Text = Worksheets("Data").Cells(2, 4).Value
End Sub

My problem is that the value in row 2 column 4 is a time and on the
form it displays a decimal value

is there a way to make my text box display this number as a time
instead?


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
Text import wizard defaults? Bruce Bowler Excel Discussion (Misc queries) 4 April 3rd 23 10:57 AM
Set Defaults in File Import of a Text File Dkline Excel Worksheet Functions 2 January 28th 08 06:20 PM
Changing fixed width (column break) defaults when importing text NaughtonNJ Excel Discussion (Misc queries) 1 May 3rd 06 06:13 PM
How do I set text box defaults for added boxes? an1441na Setting up and Configuration of Excel 0 March 24th 06 12:33 AM
How do you change sort defaults for combined text number & hyphen. Anna Excel Discussion (Misc queries) 1 April 8th 05 05:01 AM


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