'// x = number to convert
'// precision = how many decimals places to the right
'// If less than 1,000 then no comma needed
'// exit sub
NUM2STR = STR_X
'// FIND A DECIMAL
DECPOS
= INSTR(STR_X
, ".")
'// WORK ON DECIMAL SECTION
IF DECPOS
= 0 THEN ' // NO DECIMAL? DEC_STR = ".00"
DEC_STR
= MID$(STR_X
, DECPOS
, PRECISION
+ 1)
'// If there is a decimal, calc string, otherwise the int_str = the string
INT_STR = STR_X
INT_STR
= LEFT$(STR_X
, DECPOS
- 1)
COMMA = ""
J = 0
J = J + 1
COMMA
= MID$(INT_STR
, I
, 1) + "," + COMMA
J = 0
COMMA
= MID$(INT_STR
, I
, 1) + COMMA
NUM2STR$ = COMMA + DEC_STR