ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   text box displaying time? (https://www.excelbanter.com/excel-programming/276399-text-box-displaying-time.html)

scrabtree23

text box displaying time?
 
On a userform, I placed a text box that ties to a cell in
a worksheet that displays a time. However, the text box
converts the time to serial code. How do I make the text
box display the time as time?

SDC

tomhaddock[_5_]

text box displaying time?
 
Hi

Use property Text instead of Value to call the value of the cell. For
example in the Initialise event I have:

Private Sub UserForm_Initialize()

TextBox1.Text = Cells(1, 1)*.Text*

End Sub

The Text property takes the data as formatted rather than its true
value.

Tom

Tom Ogilvy

text box displaying time?
 
the easiest approach in my opinion is to load the textbox with a string
rather than using a control source. Clear your control source and in the
userform initialize event

Textbox1.Text = Worksheets(1).Range("A1").Text

--
Regards,
Tom Ogilvy


"scrabtree23" wrote in message
...
On a userform, I placed a text box that ties to a cell in
a worksheet that displays a time. However, the text box
converts the time to serial code. How do I make the text
box display the time as time?

SDC





All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com