How do I stop a Textbox in a Userform converting numbers?

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

Probably a really stupid question... but how do I stop a Textbox on
userform from removing the leading zero on a number?

eg 01234567890 becomes 123456789
 
Alan

You must format the cell first as text. e.g

Private Sub CommandButton1_Click()
Range("A6").NumberFormat = "@"
Range("A6").Value = TextBox1.Text
End Sub

Regards
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.

Ask a Question

Back
Top