![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 02:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com