How do I Format to display a fractional value regardless of user's country?

PoggiPJ

Active Member
Joined
Mar 25, 2008
Messages
330
How could you modify the following format statement so that the UserForm will always display properly regardless of the user's country settings? All users will run the same application copy, so I cannot make different versions with the appropriate code for that country.
Code:
Dim RateFactor As Single

RateFactor = 1.234

userform.variable = Format(RateFactor, "number")
For example, in the UK, I need this to display as 1,234 but in the US, I need it to display as 1.234

Right now, all I see is a blank userform field.
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi,

I think you dont need any special format.

This worked for me

Code:
Private Sub UserForm_Initialize()
    Dim RateFactor As Single
    RateFactor = 1.234
    Me.TextBox1 = RateFactor
End Sub

and the TextBox shows 1,234 accordingly to my Regional Settings, ie,
decimal separator = , (comma)

M.
 
Upvote 0
Interesting. I thought that is what I had originally and it didn't work in Germany.

Weird...only in Germany?

I have never faced problems with numbers.

Sometimes with dates (my regional setting is dd/mm/yyyy) i had some problems but always got a workaround.

M.
 
Upvote 0
No, Marcelo - I stand corrected. I changed it as you described, and then tested it by changing my own Regional Settings. It works as advertised, so I must be confused in what I had coded previously.
Thank you!
 
Upvote 0
No, Marcelo - I stand corrected. I changed it as you described, and then tested it by changing my own Regional Settings. It works as advertised, so I must be confused in what I had coded previously.
Thank you!

Great!

Glad for providing some help :)

M.
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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