Userform Textbox Format

Eclipse

New Member
Joined
Mar 19, 2009
Messages
2
Hello!

I just finished with a userform that I've been working on for the past few days and I can't figure out how to format a textbox in VB. I'd like the numbers when entered into the userform to read "$#,###,###" but I can't for the life of me get anything I try to work. If my textbox is labeled TextBox1 how can I format it? And should I enter the code into the Private Sub UserForm_Initialize() sub heading?

Have a great weekend and thanks in advance!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Welcome to the Board!

You can apply formatting when you exit the text box:

<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> TextBox1_Exit(<SPAN style="color:#00007F">ByVal</SPAN> Cancel <SPAN style="color:#00007F">As</SPAN> MSForms.ReturnBoolean)<br>    TextBox1.Value = Format(TextBox1.Value, "$#,###,###")<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Hope that helps,
 
Upvote 0

Forum statistics

Threads
1,214,769
Messages
6,121,438
Members
449,032
Latest member
egspen2

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
Back
Top