I have textbox1 in a user form and I want it to format the numbers that the user puts in to this. ##:## but I can't get this to work. Can someone please help me. TIA
The easiest way is to use the TextBox controls AfterUpdate event. This will cause the
contents of the field to be formatted/reformatted as you require when the user leaves the
field. It's not practical to try and format the field while they are editing it. Add
this code to your UserForm:
Private Sub TextBox1_AfterUpdate()
TextBox1.Text = Format$(TextBox1.Text, "#0.##")
End Sub
HTH + Cheers - Peter
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.