Decimal point in European Numbers
Posted on 2006-03-29
I know that this question has been asked a few times one of the best threads was Question 20347482 and Azrasounds reply.
The point is that using val(MyText) does not work in Europe where the decimal separator is a comma.
so val(0,123) = zero and not 0.123 and val(1,234) = 1 not 1.234
The advice using CDbl(0,123) = 0.123 does not work if there is any non-numeric characters in the text, which defeats the point of using it.
so I am left with creating a function like Azrasound suggested
But I just want to use it on examples where I would have used Val("1,234") = 1.234
and also Mytext = "1 item" val(Mytext) = 1
My project has over 1200 instances where I need the value of a string returned. So to add code to solve this for say German users is impractical.
The following is garbage , but gives the idea of what I think I need.
Public Function eVal(ByVal Expression)
if Expression contains a comma And doesnt contain any non-numeric chatacters then
MyText = "1,234 Items"
eVal(MyText) = 1.234
It has to work returning the correct value of a text string irrespective of what the users Regional and Language settings are.
Its quite simple really but Im chasing my tail trying to make it work
So for 500 points who can help me out?