I don't know why but the string in vba is "12.00" and when I conver to a double with
myDouble= CDbl(stringDouble)
or
myDouble = stringDouble
I cannot do anything.. any help? (I cannot change the regional settings to US on all pcs..)
thanks
As you already noted in your comments, this is a regional setting - as your system is using ,
as the decimal separator, the string gets converted to 1200
. The solution in this case is to convert it with Val
:
Sub Sample()
Dim myDouble As Double
Dim stringDouble As String
stringDouble = "12.00"
myDouble = Val(stringDouble)
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With