Userform Textbox Time Display

DKTRL

Board Regular
Joined
Jul 21, 2013
Messages
153
Dear All

Did anyone know how to format textbox to display time in this manner 00:00 ?

currently i am using a userform to import data from a worksheet. but instead of the time on the worksheet is display 09:00 after import to the userform textbox it became 0.375.

Hope someone can give me a help !


Thanks !
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

BrianMH

Well-known Member
Joined
Mar 26, 2008
Messages
1,490
Excel forms are limited in what they can do. You won't be able to set a time format in the textbox on an excel userform. You will need to format it when populating. So where your code is pulling through the time you can use the format option.

Code:
tb1 = Format(yourtimevalue,"HH:MM")
 

DKTRL

Board Regular
Joined
Jul 21, 2013
Messages
153
Excel forms are limited in what they can do. You won't be able to set a time format in the textbox on an excel userform. You will need to format it when populating. So where your code is pulling through the time you can use the format option.

Code:
tb1 = Format(yourtimevalue,"HH:MM")


Dear Brian

Thanks for your respond, i have try a lot format that read from the forums, but non of them is work. and finally got this formula to work .

Thanks


Code:
me.Textbox1.value = Format(Worksheets("sheet1").Range("A1"),"hh:mm")
 

Forum statistics

Threads
1,171,463
Messages
5,875,656
Members
433,145
Latest member
nzltrippa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top