PDA

View Full Version : Sleeper: Country settings changed via vba



michelle
07-04-2005, 01:14 AM
Dear excel vba users,



We do have a big problem with the use of comma?s (,) and points (.) with the calculation of cells.

Sometimes the country settings of our colleagues are set to UK and sometimes to Dutch. In Holland and the UK these symbols have different properties.
Is there a possibility to change the country settings in vba?


If yes, can someone give source example(s)?



Nice regards,



Michelle. :dunno

Bob Phillips
07-04-2005, 02:44 AM
We do have a big problem with the use of comma?s (,) and points (.) with the calculation of cells.

Sometimes the country settings of our colleagues are set to UK and sometimes to Dutch. In Holland and the UK these symbols have different properties.
Is there a possibility to change the country settings in vba?

Michelle,

I assume this is VBA?

If you use US formats within your VBA code, Excel automatically converts it correctly for the local settings, so setting say rng.NumberFormat = "#,##0.00" will give 1,234.56 in the US, and 1.234,56 in the Netherlands (assuming that I have the correct Dutch format).

It gets a bit trickier with dates, but if you use an unambiguous format, such as dd mmm yyyy, you should be fine.

michelle
07-04-2005, 09:58 AM
Hello Xld,

The problem is if people are filling in for example 100,35 (dutch, 35 cent) We are using a UK country setting, by reading and multiply the "value" an error will occur because it is an string.

We are thinking when we changing the country settings to for example to dutch the uk point will translated to our comma, no error will occur.

Is it possible change the country settings?

Michelle. :(