View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default String to Number Conversion Problem

Hi Rainer

You can use a simple substitute function:

a = WorksheetFunction.Substitute("25.000", ".", ",", 1)
vDouble = CDbl(a)

Regards,
Per

"Rainer Bielefeld" skrev i meddelelsen
...
Hi,

I'm running a german Office, which means Decimal-Seperator is "," and
Thousands-Seperator is "."
and I want to convert Strings which are using "." and "," as Decimal- and
Thousands-Separator to Numbers.

For example I want to convert "25.000" to 25.

I've tried

Application.UseSystemSeparators = False
Application.DecimalSeparator = "."
Application.ThousandsSeparator = ","
vDouble = CDbl("25.000")
Application.DecimalSeparator = ","
Application.ThousandsSeparator = "."
Application.UseSystemSeparators = True

but the result is 25000?

Can anyone help?

Regards,

Rainer