ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   format Text box in userform (https://www.excelbanter.com/excel-programming/409321-format-text-box-userform.html)

amit

format Text box in userform
 
hi need help with being able to format text box in userforms as $ instead of
an unformatted number. so currently for eg my text box shows 232434 i would
like it to be represented as 232,434$ in the text box....this is a trvial
question but i've tried looking up some stuff on this.

any help much appreciated....

Mike H

format Text box in userform
 
Amit,

Right click the textbox, view code and paste this in

Private Sub TextBox1_AfterUpdate()
TextBox1.Text = Format(TextBox1.Text, "###,###" & "$")
End Sub

The format is updated when you click out of the text box.

Mike

"amit" wrote:

hi need help with being able to format text box in userforms as $ instead of
an unformatted number. so currently for eg my text box shows 232434 i would
like it to be represented as 232,434$ in the text box....this is a trvial
question but i've tried looking up some stuff on this.

any help much appreciated....


amit

format Text box in userform
 
hi MIke - thx for the response......only one question though...will this work
if i put this into the userform initialize sub so when the form is displayed
it has the text formatted ?

"Mike H" wrote:

Amit,

Right click the textbox, view code and paste this in

Private Sub TextBox1_AfterUpdate()
TextBox1.Text = Format(TextBox1.Text, "###,###" & "$")
End Sub

The format is updated when you click out of the text box.

Mike

"amit" wrote:

hi need help with being able to format text box in userforms as $ instead of
an unformatted number. so currently for eg my text box shows 232434 i would
like it to be represented as 232,434$ in the text box....this is a trvial
question but i've tried looking up some stuff on this.

any help much appreciated....


amit

format Text box in userform
 
hi - htis doesnt seem to wrok when i put thsi in the userform initialize
sub.....any particular reasons?

"amit" wrote:

hi MIke - thx for the response......only one question though...will this work
if i put this into the userform initialize sub so when the form is displayed
it has the text formatted ?

"Mike H" wrote:

Amit,

Right click the textbox, view code and paste this in

Private Sub TextBox1_AfterUpdate()
TextBox1.Text = Format(TextBox1.Text, "###,###" & "$")
End Sub

The format is updated when you click out of the text box.

Mike

"amit" wrote:

hi need help with being able to format text box in userforms as $ instead of
an unformatted number. so currently for eg my text box shows 232434 i would
like it to be represented as 232,434$ in the text box....this is a trvial
question but i've tried looking up some stuff on this.

any help much appreciated....



All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com