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

查看:19
本文介绍了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 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天全站免登陆