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
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

jag108

Active Member
Joined
May 14, 2002
Messages
433
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
433
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
433
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?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,001
Messages
5,834,820
Members
430,324
Latest member
bosphoruskid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top