Format userform Textbox for currency

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,832
Office Version
  1. 2007
Platform
  1. Windows
Morning.

On my userform im trying to format Textbox5 to show currency

I have tried the following but when i wish to type say £55.00 i see as i type £5.00 then £5.01
VBA Code:
TextBox5 = Format(TextBox5, "£#,##0.00")
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hello,
Did you check your numbers format separators in Excel settings ? It seems to me it could be misinterpreting the commas/points separtors.
I suggest you select a "basic" currency format in the Excel drop down list, adapt it to your needs, and then copy/paste it in the UF.
 
Upvote 0
This is on a userform & textbox.
When i type the veiw is incorrect.
I cant see how to format it so i assume it must be hardcoded & not rightclick select format option
 
Upvote 0
this works for me
VBA Code:
Private Sub TextBox5_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
    If Len(TextBox5) = 0 Then Exit Sub
    If IsNumeric(TextBox5) Then
        TextBox5 = Format(TextBox5, "£ #,##0.00")
    Else
        MsgBox "Please enter a monetary value"
        TextBox5 = ""
        Cancel = True
    End If
End Sub
 
Upvote 0
Solution
The best i could get was the following code below to produce £123 as opposed to £123.00

VBA Code:
TextBox5.Value = Format(TextBox5.Value, "£###,##")

I have now used you advised code & it works.
Thanks
 
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