Format number in Msgbox

hoanganhdl

New Member
Joined
Dec 9, 2016
Messages
2
Code:
Sub test()


    Application.DecimalSeparator = ","
    Application.ThousandsSeparator = "."
    Application.UseSystemSeparators = False


    MsgBox Format("123456", "#,##0")


Exit Sub

I want result is 123.456 but it is 123,456.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Code:
Sub test()
Dim sNum As String


    sNum = Format("123456.4", "#"".""##0")


    MsgBox sNum


End Sub

It comes thru as a String but it works.
 
Upvote 0
Oh thanks, I'm going to have a look into this.
:)
Type the function name Format in the Immediate Window (press CTRL+G if you don't see it) inside the VB editor and then, with the text cursor next to or inside the word, press the F1 key to bring up the help file for that function... scroll to the bottom of the help page and look at the next-to-last entry in the displayed table. You might also find this link of interest...

https://en.wikipedia.org/wiki/Escape_character
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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