Format Textbox w/ $ sign

J

jeff

I guess I'm not going to find this out with a search. Seems it would
be simple.

All I want is for TextBox10 to have a $ sign in it. I'll even let the
user supply the decimal.
I've tried variations of this in the initialization sub:
TextBox10 = Format(c, "###,###.##")
I've tried it w/ the C, w/o the C. With $ signs. Anything I could
think of. Any help would be appreciated.
Thanks
j.o.
 
J

Jeff

Private Sub TextBox10_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox10.Value = Format(TextBox10.Value, "$ #,##.00")
End Sub
 
J

jeff

Private Sub TextBox10_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  TextBox10.Value = Format(TextBox10.Value, "$ #,##.00")
End Sub






- Show quoted text -

I do appreciate the help. But, it still doesn't show with the $ in the
textbox. I see the word "exit" in the statement you gave me. That
makes me wonder if I was misunderstood. What I want is for the
$ to show up in the textbox when the userform comes up. Then the
user puts in the amount.
thanks
j.o.
 
J

Jeff

Private Sub TextBox10_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox10.Value = Format(Me.TextBox10.Value, "$ #,##.00")
End Sub

Private Sub UserForm_Initialize()
Me.TextBox10.Value = "$"

End Sub
 
J

JP

I'd go with the other Jeff's suggestion, except use the AfterUpdate
event instead. The Exit event will pointlessly fire every time you
leave the text box, even if it hasn't been updated.

Private Sub TextBox10_AfterUpdate()
Me.TextBox10.Value = Format(Me.TextBox10.Value, "$ #,##.00")
End Sub

Private Sub UserForm_Initialize()
Me.TextBox10.Value = "$"
End Sub


--JP
 

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

Top