format number in textbox on userform

MKLAQ

Active Member
Joined
Jan 30, 2021
Messages
397
Office Version
  1. 2016
Platform
  1. Windows
hello
I have 4 textboxes linked with 4 cells when I run the userform should show the number like this 1,200,300.00 in four textboxes
this what i got but not work


VBA Code:
Private Sub UserForm_Activate()
TextBox1.value = Format(TextBox1.value, "#,##0.00")
TextBox2.value = Format(TextBox2.value, "#,##0.00")
TextBox3.value = Format(TextBox3.value, "#,##0.00")
TextBox4.value= Format(TextBox4.value, "#,##0.00")
End Sub
any suggestion,please ?
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi,​

If the cell is well formatted so the better is to use the Text property of the cell rather than formatting the Text Box …​
 
Upvote 0
I missed that the textboxes are linked to cells. If you change the textboxes as shown, it will update the linked cells to text, and then may re-convert to numbers and you are back where you started. If you care about the formatting in the textboxes you should not link them to cells to populate them. That technique should be used only to enter data in the textboxes that will be used to populate the cells.

You need to explain your whole scenario so we can suggest an alternative approach.
 
Upvote 0
@6StringJazzer I've found many solution by change or exit event but this is not what I want , theses work when enter the values as you said but I want to do that when I userform like search theses texboxes linked with listbox when run the userform should show all data in listbox and textboxes by Activate or Initialize events in userform , is it possible?
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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