format number in textbox on userform

MKLAQ

Active Member
Joined
Jan 30, 2021
Messages
428
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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