Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA Double as String with comma and not point

Tags:

format

excel

vba

I am searching for a solution to convert a double to a string, but the string should have a comma before the decimal place, not a point.

"One and a half" should look that way 1,5 (german notation).

Thanks for your help!!

like image 841
mrbela Avatar asked Dec 12 '22 01:12

mrbela


1 Answers

A combination of CStr and Replace will do the job.

Function Dbl2Str(dbl As Double) As String
    Dbl2Str = Replace(CStr(dbl), ".", ",")
End Function
like image 175
Jeanno Avatar answered Jan 12 '23 14:01

Jeanno