Hi, I want to change the numeric value in a cell to a string with 1000 Separator(,), e.g. numeric 1000 will to string "1,000" and 123456789 will change to string "123,456,789". How to do that in VBA? Thanks
VBA Excel: change numeric value to string with 1000 separator (,)
-
-
-
Re: VBA Excel: change numeric value to string with 1000 separator (,)
CodeSub test() ActiveCell.NumberFormat = "_-* #,##0_-;-* #,##0_-;_-* ""-""??_-;[email protected]_-" ActiveCell.Value = "'" & Trim(ActiveCell.Text) End Sub
-
-
Re: VBA Excel: change numeric value to string with 1000 separator (,)
Thanks, but it cannot cater if the cell value = 0, it will become "-" ... any idea?
-
Re: VBA Excel: change numeric value to string with 1000 separator (,)
Hmm... Both codes fail that one in different ways, it seems.
A slight tweak to jindon's code (as his is more flexible than mine)
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!