Range.Formula属性是否转换为其他语言环境 [英] Does Range.Formula property translate to other locale

查看:66
本文介绍了Range.Formula属性是否转换为其他语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在Excel英文版的工作表中手动输入公式并将此文档发送给另一个版本为Excel的用户时,公式将自动翻译为打开文档所用的语言.

When a user manually enters formula in a sheet in the English version of Excel and sends this document to another user who has Excel in another version, the formula is automatically translated to the language in which the document is opened.

'Formula entered in Sheet1!B1 in the English Excel version
=VLOOKUP(A1,Sheet2!$A$1:$C$150,3,FALSE)
'Formula as shown in a Dutch Excel version
=VERT.ZOEKEN(A1;Sheet2!$A$1:$C$150;3;ONWAAR)

当我以编程方式添加公式时,英语版本看起来像这样:

When I programmatically add a formula, in my English version, it would look like this:

Sub AddFormula()
    ThisWorkbook.Worksheets("Sheet1").Cells(1, 2).Formula = "=VLOOKUP(A1,Sheet2!$A$1:$C$150,3,FALSE)"
End Sub

如果要在我的英文版上运行此过程,然后保存文档,然后将其发送给使用另一种语言的用户,则可以使用公式,因为该公式位于单元格中,因此可以转换为该语言的任何语言和语言环境第二个用户使用.

If I were to run this procedure on my English Version, then save the document and send it over to a user with another language, it would be fine as the formula is in the cell and thus translated to whatever language and locale the 2nd user uses.

我的问题是,第二位用户使用荷兰语(或其他语言)Excel以EN-US格式编写的代码中的公式运行该过程时会发生什么.它会被翻译还是会引发错误?如果是后者,我将如何解决并使公式插入语言得到证明?

My question is what happens when the 2nd user runs the procedure, in the Dutch (or other language for that matter) Excel with the formula in the code written in the EN-US format. Will it be translated or will it throw an error and in case of the latter, how would I solve that and make the formula insertion language proof?

推荐答案

在Excel vba中,.Formula要求插入的公式为EN-USA格式.这与本地设置无关.

In Excel vba the .Formula requires that the formula to be inserted be in EN-USA format. This is regardless of the local settings.

然后将Excel放入表格中时,Excel会将其翻译成本地语言.

Excel will then translate it into the local vernacular when putting it in the sheet.

因此,无论什么本地设置,它都可以跨语言工作.

So no matter what the local settings it will work cross languages.

VBA还具有.FormulaLocal,它允许以本机语言输入公式.但是(据我所知),它将无法在不同的本地设置下工作.

VBA also has the .FormulaLocal which allows the entry of the formula in the native language. But (as far as I know) it will not work cross different local settings.

这篇关于Range.Formula属性是否转换为其他语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆