View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Juan Pablo González Juan Pablo González is offline
external usenet poster
 
Posts: 226
Default ValueBox? or force TextBox to read/format value

Leo Elbertse wrote:

To get round the problem I use Replace(TextBox1.Value, "." , ",") but
this is rather a kludge AND what if the user actually enters a number
in proper thousands notation: 1.234,56 than this creates havock.

I simply cannot believe there is no easy solution, but I wouldn't know
how.

Thanks for any assistance,

Leo


Part of the problem is solved by using these values:

?Application.International(xlDecimalSeparator)
..
?Application.International(xlThousandsSeparator)
,

that way, you can "know" what the user tried to enter in his "own" language.
Then, convert it to a "real" number. What I do is something like

St = InputBox("Enter the number")
St = Replace$(St, Application.International(xlThousandsSeparator), "")
'Remove the comma
St = Evaluate(Chr$(34) & St & Chr$(34) & "+0")

to let Excel handle the conversion ! instead of reinventing the wheel...

--
Regards,

Juan Pablo González