Reputation: 75
I want my Price Text Box to have decimal format so when a user types 1000000
it shows 1.000.000
.
I tried the code below but it doesn't show the decimal format in Price Textbox.
Private Sub UserForm_Initialize()
tbPrice.Text = Format(Number, "0.000")
End Sub
Upvotes: 0
Views: 1767
Reputation: 2153
You are updating the value on ForUserForm_Initializem()
which will only update once the User form is loaded for first time. So in order to update the value which user enters into the textbox, you have to use AfterUpdate()
Private Sub tbPrice_AfterUpdate()
tbPrice.Text = Format(tbPrice.Text, "0.000")
End Sub
This function will called every time the user updates the value in the textbox - tbPrice
Upvotes: 1