Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Defaults Text Box with Time
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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text import wizard defaults? | Excel Discussion (Misc queries) | |||
Set Defaults in File Import of a Text File | Excel Worksheet Functions | |||
Changing fixed width (column break) defaults when importing text | Excel Discussion (Misc queries) | |||
How do I set text box defaults for added boxes? | Setting up and Configuration of Excel | |||
How do you change sort defaults for combined text number & hyphen. | Excel Discussion (Misc queries) |