TextBox formatting

tungchiu

New Member
Joined
Nov 20, 2005
Messages
34
Hi again!
How can I format a TextBox so that any numerical data that is entered into it will automatically be formatted as currency?
Thanks
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

jag108

Active Member
Joined
May 14, 2002
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
try
put this on UserForm_Initialize()
Format(textbox1, "$#,##0.00_);[Red]($#,##0.00)")
 

jag108

Active Member
Joined
May 14, 2002
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
revised plan of attack.
Try
This can also go on the initialisation of the user form
UserForm1.TextBox1.Text = Format("$#,##0.00_);[Red]($#,##0.00)")
 

tungchiu

New Member
Joined
Nov 20, 2005
Messages
34
Thanks jag108!
I have tried what you suggested but when I run the UserForm, the TextBox appears with the format specs visible in it ($#,##0.00_);[Red]($#,##0.00). Am I doing something wrong?
 

jag108

Active Member
Joined
May 14, 2002
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS

ADVERTISEMENT

Which version of Excel are you using?

I will get back to you.
 

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Hi
try TextBox1_Exit()

Code:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox1 = Format(Me.TextBox1, "$#,##0.00")
End Sub
 

tungchiu

New Member
Joined
Nov 20, 2005
Messages
34

ADVERTISEMENT

I'm don't what version of Excel I have - where can I find that info?
 

Watch MrExcel Video

Forum statistics

Threads
1,118,383
Messages
5,571,818
Members
412,420
Latest member
Quintankerus
Top