简体   繁体   中英

Multi-language Excel VBA Macro (French / English / Swedish)

Good evening!

I have developed a macro in English on a Swedish Mac. The macro runs on aa Mac used in France with Excel in French. All the Subroutines work very well... but one. I used the formula "=VALUTA(123,4567)" [Swedish for currency] so that it should truncate to 2 decimals and then convert to text. The corresponding French formula is "=DEVISE(123,4567)", which I now use. I fill a whole column with this formula with the VBA-macro but the result is "NOM?" [name?]; one would think Excel does not recognize DEVISE().

However, and this is the real question, if I mark any of these cells and press RETURN (manually, that is) it recognizes the formula and prints 123,45!!!

I am quite frustrated. Any pointers towards a solution would be greatly appreciated. Thank you.

I found a way to do it. The code uses ROUNDDOWN() to 2 decimals [which is OK but not really want I wanted] which also works in French Excel, rather than DEVISE(). After that I use concatenation to get the values of with two decimals. If I do not use ROUNDDOWN(), the result will be "Place: 2.34567". So this is what I have now:

ActiveSheet.Range("A5").Formula = "= LOOKUP(2,1/(H:H>1),H:H)" ActiveSheet.Range("AJ138")=ROUNDDOWN(A5,2) ActiveSheet.Range("AQ13:AQ129").Formula = "=""Place: ""&AJ13&"

That is the best I can do. Thank you all for responding. I will post another question, how to get the address found by the lookup function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM