Format of a TextBox in a userform

  • Thread starter Thread starter MD
  • Start date Start date
M

MD

Good day,

I have a userform that has a TextBox. In this TextBox, I want to enter
dollar amounts so that it looks like this: 1 234 567 $. Right now I get
this: 1234567.

regards,

MD
 
In the TextBox_Change event add following code

TextBox1.Text = Replace(Format(TextBox1.Text, "#,##0 \$"), ",", " ")\

Sharad
 
Try,

Textbox1.Text = Format(the_amount,"# ### ##0$")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thx Bob, onw more Q. I actually have 3 textboxes, when I run the code it
only does it on 1... I have the code setup like so...

Private Sub UserForm_Initialize()
volet_1.TextBox11.Value = Format(Sheets("data").Range("a11").Value, "#
### ##0 $")
volet_1.TextBox12.Value = Format(Sheets("data").Range("A12").Value, "#
### ##0 $")
volet_1.TextBox13.Value = Format(Sheets("data").Range("a13").Value, "#
### ##0 $")

End Sub
 
I am surprised. I just created a form and tried it, and it worked fine. I
assume the form is named volet_1, and that the wrap-around we see in the NG
is not in your code.

BTW, could I suggest that you use Sharad's solution, it is better than mine
(:-)).

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top