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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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.
 
Upvote 0
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 ??
 
Upvote 0
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%")
 
Upvote 0
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 !!!]
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,664
Members
448,976
Latest member
sweeberry

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
Back
Top