Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Colorizing countries | Excel Discussion (Misc queries) | |||
formatting in different countries | Excel Worksheet Functions | |||
Problems using Excel from different countries | Excel Discussion (Misc queries) | |||
Using Excel in different countries | Excel Worksheet Functions | |||
world countries | Excel Discussion (Misc queries) |