Userform textbox formatting

Linus_99

Board Regular
Joined
Aug 28, 2002
Messages
145
I am using a textbox on a userform to update a cell in a spreadsheet, & having some trouble with the formatting.

On the spreadsheet the cell with the control source is formatted as a time (e.g.08:00 am) while the textbox on the userform displays 0.33333.

On the userform, I can type in a formatted date such as 09:00 into the text box & this updates the spreadsheet correctly, but it's not a good look !

Any advice on how to format the textbox on the userform to show the time as 08:00 am would be appreciated.

Thanks,
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Fryer Tuck

Board Regular
Joined
Mar 20, 2002
Messages
64
I haven't worked as much with time, but I have solved my formatting problems by loading with the format

eg. TextBox = Format(Range("A1"),"0.00%")

Hope that helps
F.T.
 

Linus_99

Board Regular
Joined
Aug 28, 2002
Messages
145
Thanks F.T. but it doesn't seem to work.

I'm getting the control source cell position from a selected row in a text box, & then setting the control source by:

Tstart.ControlSource = "d" & Slist.ListIndex + 2

When I tried your suggested method to format Tstart, the control Tstart appeared correctly as 08:00 am in the text box on the form, but when I overtyped it with a new time value, the original cell in the worksheet was not updated.

Thanks anyway. Any other ideas ??
 

Fryer Tuck

Board Regular
Joined
Mar 20, 2002
Messages
64
Sounds like you are missing the command to update the sheet after the form is updated.
(Again, at this point, I have had to use the "format" equation, such as
Range("A1")=format(textbox1,"0.0%")
 

Linus_99

Board Regular
Joined
Aug 28, 2002
Messages
145
Thanks for your help F.T.

I added a BeforeUpdate sub with the "reverse formatting" you suggested and it now seems to be working fine.

[A complicated way to solve what appeared to be a simple formatting exercise !!!]
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,537
Messages
5,832,310
Members
430,128
Latest member
ojl987

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