Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comma and Point

Status
Not open for further replies.

radubalmus

Programmer
Apr 26, 2007
49
EU
I am using VBA to calculate some values:
Code:
energy = (speed / 3.6) ^ 2 * weight / 1000 / 2
sheet.Cells(20, 2).Value = energy

and on the PC i am working i obtain:

energy = 92.32423

but when i am trying to use the macro on an other PC i got:

energy = 92,32423

and when i am trying to show the energy in a cell it is showing me

9232423


There are simple solutions for almost every problem! The hard part is to see them!!!!
 
radubalmus,
Take a look at the Regional Options on the suspect computer. Some European locals exchange the comma and period in number formats. If the computer is set for one of these locals and you override the number format in Excel I believe you would get this type of result.

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Yes CautionMP you are right..
So i discovered my self..
On the pc i was try to implement the Regional Language was Spanish...


and the way nubers are showed is diffrent:

In english: 123,456,789.00
In spanish: 123.456.789,00

:))



There are simple solutions for almost every problem! The hard part is to see them!!!!
 
VBA seems to want to think in US date formats in some commands when given strings, even if Excel &/or the spreadsheet has been told to default to UK formats.

I know I have to use Day and Month to force the issue instead of DateValue. Annoying innit?
 
Simply use use non ambiguous format, like #yyyy-mm-dd#

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top