Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Calculations in different countries

I have a macro that is used by people in the US and in
Germany. The macro adds columns to check total debits vs.
total credits.

When I run it in the US, it works fine because it sees
50.25. But when the macro runs for one of the German
users, it sees 50,25 and it doesn't use the 25 in
calculating the total.

The reason for the difference is in this line of code:

TotalDebits = TotalDebits + Val(ActiveCell.Offset(0, 5))

According to Help: "The Val function recognizes only the
period (.) as a valid decimal separator. When different
decimal separators are used, as in international
applications, use CDbl instead to convert a string to a
number."

How do I use CDbl in the offending line of code?
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Calculations in different countries

Try this,


TotalDebits = TotalDebits + Val(Replace(ActiveCell.Offset(0, 5), ",", "."))


Salutations!


a écrit dans le message de ...
I have a macro that is used by people in the US and in
Germany. The macro adds columns to check total debits vs.
total credits.

When I run it in the US, it works fine because it sees
50.25. But when the macro runs for one of the German
users, it sees 50,25 and it doesn't use the 25 in
calculating the total.

The reason for the difference is in this line of code:

TotalDebits = TotalDebits + Val(ActiveCell.Offset(0, 5))

According to Help: "The Val function recognizes only the
period (.) as a valid decimal separator. When different
decimal separators are used, as in international
applications, use CDbl instead to convert a string to a
number."

How do I use CDbl in the offending line of code?
Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Calculations in different countries

TotalDebits = TotalDebits + cDbl(ActiveCell.Offset(0, 5))


Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

wrote in message
...
I have a macro that is used by people in the US and in
Germany. The macro adds columns to check total debits vs.
total credits.

When I run it in the US, it works fine because it sees
50.25. But when the macro runs for one of the German
users, it sees 50,25 and it doesn't use the 25 in
calculating the total.

The reason for the difference is in this line of code:

TotalDebits = TotalDebits + Val(ActiveCell.Offset(0, 5))

According to Help: "The Val function recognizes only the
period (.) as a valid decimal separator. When different
decimal separators are used, as in international
applications, use CDbl instead to convert a string to a
number."

How do I use CDbl in the offending line of code?
Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Colorizing countries Babymech Excel Discussion (Misc queries) 0 June 5th 09 11:13 PM
formatting in different countries Libby Excel Worksheet Functions 5 May 11th 08 09:41 PM
Problems using Excel from different countries Jose Mourinho Excel Discussion (Misc queries) 1 June 14th 07 12:52 PM
Using Excel in different countries Giri Excel Worksheet Functions 3 November 19th 05 01:31 PM
world countries zaifi Excel Discussion (Misc queries) 1 October 12th 05 09:17 AM


All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"