Number Format for Txt and Lbl

Jug

New Member
Joined
Feb 8, 2006
Messages
16
Hello,

Was hoping I could get some help on this...

I created a userform in excel's vb environment. On the form I have two text boxes, a label and a command button. It is basically a calculator.

The user inputs numbers into the two text boxes, hits the command button which then inputs the result into the label caption.

"label1.caption = text1.value * text2.value"

My question is... how do you format the text boxes and label so that the numbers uses commas so it looks like "1,000,000" instead of "1000000" when the user inputs them and also when it calculates.

Thanks a bunch.

-Jug
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Use

label1.caption = worksheetfunction.text(text1.value * text2.value,"_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)")
 
Upvote 0
Or,
Code:
label1.caption = format(text1.value * text2.value,"#,##0")
 
Upvote 0

Forum statistics

Threads
1,203,102
Messages
6,053,538
Members
444,670
Latest member
laurenmjones1111

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